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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date formula in record selection

Status
Not open for further replies.

sammybee

Programmer
Sep 24, 2003
103
GB
Hi all,

I want to ammend a report in V7 which currently reads FieldA = Date(YYYY, MM, DD) -- and has a fixed date.

to say FieldA = CurrentDate what is the correct way of doing this as I keep getting an error relating to needing a string!

Many thanks

Sam
 
In Crystal 8.5, I'd do it as FieldA = ToText(CurrentDate) - turn the date into a string. Or else turn FieldA into a date.

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
You also have to match the format of the date string in FieldA

For example if the format in FieldA is MM/DD/YYYY, then

FieldA = ToText(currentdate,"MM/dd/yyyy")

Cheers,

-LW
 
Hi All,

Have tried both of the above formula's and am getting an error message saying a date-time is required here and the cursor hovers in before totext. Any ideas?

Many thanks

Sam
 
Is FieldA a date, datetime, or string field? If it's a string field what is the format used to create the date?

Have to post more technical information if you want help.

If it is a date or datetime field, then fieldA = currentdate should work. If it is a string field, then you have to match the format, including time, with the totext function.

Check the Help on ToText and format strings for date

Cheers,
-LW
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top