Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

From and To Date Range in Parameters

Status
Not open for further replies.

dbielenda

MIS
Nov 15, 2001
119
US
I need to enter a paramter field that has a From Date and To Date range. However, the date field in the database need to be converted using DateValue TABLENAME.FIELD + 60. I need a formula that will do this:

If the From Date = 6/21/00 (this date being the parameter entered by the user) then give me this date and all after it
If the To Date = 6/221/00 (this date being the parameter entered by the user) then give me this and all before it
If From Date = 6/21/00 and To Date = 7/21/00 the give me 6/21/01 through 7/21/00

I also need this displayed in the report as well. Any help/suggestions are much appreciated. I am stuck at this point..

 
you are making this too tough. First create one paramter field, a range paramter, obviously with a data type of date. Then put the following formula in your record selection:

{Datefield} in {?ParameterDatefield}

To get all items up to a certain date, select the "no lower bound" when filling in the paramter. To get all after a certain date, select "no upper bound". And to get between 2 dates just enter the 2 dates.

That should work, let me know if you have any questions. Software Support for Sage Mas90, Macola, Crystal Reports and Goldmine
 
Thanks.. I will try this then update with any questions/comments. :)
 
This formula works great with one report, however, when I use it for another report, I get an error telling me "A string is required here."

{@Date} in {?Expected Date}

The cursor is placed right before the expected date parameter. My {@Date} formula is :

if {TABLENAME.FIELD} = 99999 then "99/99/99"
else
ToText (DateValue ({TABLENAME.FIELD} +60), "MM/dd/yy")

Any suggestions for this? Thanks for your help!
 
dgilz' solution only works with date fields, and your field is text. You will need to create another formula that converts this text formula into a date, and then use that formula field with the parameter. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Do you have an example formula I can use to do this? I appreciate your feedback. All the replies here have helped me make my report better! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top