1

I need to grab the Month and Year info from 2 date/time parameters of my report (Start date and End date) into a textbox.

I used the following expression -

=MonthName(Month(Parameters!StartDate.Value)) & Format(Year(Parameters!EndDate.Value)) & " to " & MonthName(Month(Parameters!EndDate.Value)) & Format(Year(Parameters!EndDate.Value))

to get it into something like e.g. March 2012 to August 2012.

It works, however I keep getting the following Warning:

[rsRuntimeErrorInExpression] The Value expression for the textrun ‘Textbox18.Paragraphs[0].TextRuns[0]’ contains an error: Conversion from type 'Date' to type 'Integer' is not valid.

Any ideas?

Thanks!

Pedram
  • 6,256
  • 10
  • 65
  • 87
viv_acious
  • 2,429
  • 9
  • 34
  • 55

1 Answers1

1

Is that the exact expression you are using? It doesn't seem like it is because:

  • that expression works without warnings (on my system)
  • it doesn't give the output that you indicate it does
  • the expression is wrong (it lists the year of the EndDate twice rather than the StartDate's year with the StartDate's month)

So I would guess that one of the functions in the actual expression is MonthName(Parameters!StartDate.Value) rather than MonthName(Month(Parameters!StartDate.Value)) which would give the error indicated.

This also works:

=MonthName(Month(Parameters!StartDate.Value)) & " " & Year(Parameters!StartDate.Value).ToString() & " to " & MonthName(Month(Parameters!EndDate.Value)) & " " & Year(Parameters!EndDate.Value).ToString()

Either that or this isn't the expression in Textbox18

Chris Latta
  • 20,316
  • 4
  • 62
  • 70
  • Thanks so much Chris. Yea you're right with 3rd point, I made the mistake and using EndDate twice. But that shouldn't be causing the warning! I'll give your solution a go. Thank you very much! – viv_acious Mar 15 '13 at 02:55