Friday, March 23, 2012

MonthName function in IIF

Hi,
We are getting a runtime #error when using MonthName in an IIF function more
than once as follows:
IIF(Parameters!ReportPeriod.Value <
7,MonthName(Parameters!ReportPeriod.Value +
6),MonthName(Parameters!ReportPeriod.Value))
Parameters!ReportPeriod is an integer, and the expression works Ok until the
second MonthName is added.
Thanks,
MattDoes this work (by adding an explicit cast)?
= IIF(Parameters!ReportPeriod.Value > 7,
MonthName(Parameters!ReportPeriod.Value + 6),
MonthName(CInt(Parameters!ReportPeriod.Value)))
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Matt" <Matt@.discussions.microsoft.com> wrote in message
news:E9371099-FDAB-4A79-95D5-8344C8595347@.microsoft.com...
> Hi,
> We are getting a runtime #error when using MonthName in an IIF function
> more
> than once as follows:
> IIF(Parameters!ReportPeriod.Value <
> 7,MonthName(Parameters!ReportPeriod.Value +
> 6),MonthName(Parameters!ReportPeriod.Value))
> Parameters!ReportPeriod is an integer, and the expression works Ok until
> the
> second MonthName is added.
> Thanks,
> Matt|||Thanks - that works Ok.
"Robert Bruckner [MSFT]" wrote:
> Does this work (by adding an explicit cast)?
> = IIF(Parameters!ReportPeriod.Value > 7,
> MonthName(Parameters!ReportPeriod.Value + 6),
> MonthName(CInt(Parameters!ReportPeriod.Value)))
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Matt" <Matt@.discussions.microsoft.com> wrote in message
> news:E9371099-FDAB-4A79-95D5-8344C8595347@.microsoft.com...
> > Hi,
> > We are getting a runtime #error when using MonthName in an IIF function
> > more
> > than once as follows:
> >
> > IIF(Parameters!ReportPeriod.Value <
> > 7,MonthName(Parameters!ReportPeriod.Value +
> > 6),MonthName(Parameters!ReportPeriod.Value))
> >
> > Parameters!ReportPeriod is an integer, and the expression works Ok until
> > the
> > second MonthName is added.
> >
> > Thanks,
> > Matt
>
>sql

No comments:

Post a Comment