Crystal Reports 8.0 Error

25 pts.
Tags:
Crystal Report 8.0
Date calculation

I have created a formula called @DateCode:

WhilePrintingRecords;
NumberVar dblYear:= 0;
NumberVar dblWeek:= 0;
StringVar strYear:= "00";
StringVar strWeek:= "00";
StringVar strDate:= {OrderDet.User_Text1};
DateVar dtDate;
DateTimeVar dtDateTime;
StringVar strDateCode:= "0000";

If IsDate(strDate) Then
(
    dtDate:= CDate(strDate);
    dtDateTime:= CDateTime(dtDate);

    dblYear:= DatePart("yyyy", dtDateTime);
    dblWeek:= DatePart("ww", dtDateTime, crFirstJan1);
   
    strYear:= Right(ToText(dblYear, "00"), 2);
    strWeek:= ToText(dblWeek, "00");
);

strDateCode:= strYear + strWeek;

When I run the report, it gives:

Report Error: 20515
Message: Error in formula <DateCode>.
'WhilePrintingRecords;
'
A number, currency amount, boolean or string is expected here.
Do you wish to continue?

I select no and the report completes successfully. The field is coming from a text field in a linked Access database. The data is "09/13/2012". The output is the desired "1237". The formula is working, but it always gives the error anyway. How can I keep the error from appearing?



Software/Hardware used:
Crystal Report 8.0.1.0
ASKED: September 13, 2012  6:49 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • BigKat
    it looks like dblYear is 4 digit, so try the following: strYear:= Right(ToText(dblYear, "0000"), 2);
    7,565 pointsBadges:
    report
  • ShopTechBBaxter
    The output becomes "201237" and the error still shows up.
    25 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following