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

date calculation 1

Status
Not open for further replies.

bv2000

Vendor
Nov 9, 2006
12
US
how do i program a script to find tomorrow's date - no matter what today is. For example, i need to find 'tomorrow's appointments'.
 
Howdy

If your calculation is always literally 'the next day' then
(Currentdate + 1) should work just fine.

Hope this helps.

Cheers

Gez
 
If you work the standard Western 5-day week, you could get the next working day by
Code:
if DatePart("w", currentdate) = 6
then Currentdate + 2
else Currentdate + 1
Note that Satuday is day 7 and Sunday day 1, unless you set other values as your defaults.

YOu could use this value to select the records you want. Or select records with a greater or equal value and see several days ahead.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Sorry, it should be Currentdate + 3, not 2 which would show you Sunday.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Thank you for your responses. The problem i am having is that ( Currentdate + 1) gives me the answer but the answer remains stagnant - i need the answer to change every day.
 
Currentdate is not static, but instead reflects the print date/system date.

-LB
 
How would I phrase the formula for a script -
for a 7 day work week that would allow me to always find today's date + 1 Thanks
 
Just as indicated previously:

{table.date} = currentdate + 1

-LB
 
I created a field called CURRENTDATE1 which = (CurrentDate)+1. The field is formatted to look like a date (12/20/2006) When i try to create the script to automatically give me tomorrows date by entering a find with the formula INSTDATE = (CurrentDate1) I receive an error message "The value of this field must be a valid date in the range of years 1 to 4000 and should look like "12/25/2003" I am at a total loss.
 
You don't need to make a formula. You would just use

{table.INSTDATE} = currentdate + 1

... in report->selection formula->record. I would check two things. Go to Report->Set Print Date and Time and make sure that "Today's Date and Time" is checked. Also place the INSTDATE field in the detail section and verify that it is in fact a date or datetime field by running the mouse over it and observing the tool tip text, and also check the year displayed in INSTDATE.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top