Results 1 to 2 of 2

Thread: CR 11 - "A string is required here"

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jan 2004
    Location
    Southern California
    Posts
    5,034

    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,
    Blake

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    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
  •  



Click Here to Expand Forum to Full Width