|
-
Mar 14th, 2008, 04:29 PM
#1
Thread Starter
PowerPoster
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,
-
Mar 14th, 2008, 04:54 PM
#2
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|