If you've run into a problem with a SQL database and Date (or DateTime) selection criteria, you're not alone. It seems that the parameter values want to save with the Crystal SQL, and it just doesn't work properly.
This is a known Crystal anomaly.
A way to work around it is to cast your Date (or DateTime) parameter and database fields as strings (in formula fields), manipulate them so that they're in the format YYYYMMDD, and do your selection on the formula fields. Do this and Crystal ignores them for the purposes of its SQL, which may solve your problem.
For example, say you have a Date-type parameter field called Date0. You can then create a formula called ParamDateStr like this:
What you've done is to parse the Date, then rearrange the year, month and day values (making sure that months and days are two characters in length). Now, for your database field:
What you have NOW is two strings, each created from a date, and each formatted identically as YYYYMMDD. Finally, your selection criterion uses these two formula fields:
{@DOBString} >= {@ParamDateStr}
or whatever makes sense under your circumstances.
Howard Hammerman, Ph.D.
Hammerman Associates, Inc.
http://www.hammerman.com
800-783-2269
Hammerman Associates, Inc. provide Crystal Reports training,
consulting, course material, utilities and software. Consultants are available throughout North America for short or long-term assignments.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.