CR 11 - "A string is required here"
I'm using Crystal Reports 11. I have a formula in which I keep getting the Error Message: "A string is required here". My code is below.
Code:
Dim dy, mo as string
mo = month(CDate({tblTimeSheetDetail.monDate}))
dy = day(CDate({tblTimeSheetDetail.monDate}))
formula = mo & "/" & dy
The error is occurring on the hightlighted line but will probably occur on the next line as well.
Thanks,
Re: CR 11 - "A string is required here"
Unlike VB, Crystal does not automatically convert datatypes. The Month function returns an Integer so it needs to be converted to a string. Use CStr or ToText.
Unless things of changed in Version 11, Crystal has no Integer datatypes only a decimal type. The ,0 with the CStr function is used to specify the number of decimals to include in the string. Without it mo would equal "1.00"
mo = CStr(month(CDate({tblTimeSheetDetail.monDate})),0)
The dy line won't raise an error because dy is declared as a variant.