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

date selection

Status
Not open for further replies.

3dthies

Programmer
Mar 12, 2003
77
DE
for a date field i want to have a function which automatically generates a report from yesterday.

The second thing is that whe have working times from onday to saturday. so, when i start a report on monday, it should use automatically the saturday and not the sunday.
 
The formula below will pulll data from 2 days ago if the date is a Monday, otherwise it will pull from the previous day. I hope this helps.


if Dayofweek(CurrentDate) = 2 then {DateField}=Dateadd("d",-2,Currentdate) else {DateField}=Dateadd("d",-1,Currentdate)



Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
 
It don't work.

the date fiel has the following structure:

yyyy/mm/dd hh:mm:ss

Maybe that is the problem?
 
dgillz's formula should work. What version of Crystal? And have you used it to generate a value that you've then put in the selection formula?

Madawc Williams
East Anglia, Great Britain
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top