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!

Standing Order date calculation

Status
Not open for further replies.

gillianleec

Technical User
May 7, 2003
48
US
I am having trouble getting started on this project and would appreciate some direction. I have a table for Standing Orders where the user enters a client and the timeframe for which their orders should be generated. For example, they want their order bimonthly, the user would select Timeunit=month and Timenum=2:
ID
Client
Startdate
TimeUnit (week, month)
TimeNum (1,2,3,4)
Quantity

I would like to make a query that would run daily and identify Standing Orders that are due and write them to an orders table. The query would look at the day/month of the Startdate and then calculate the next due date for an order based on TimeUnit and TimeNum.

I know that I would probably use the DateAdd Function but how do I take into consideration the current date?

Gillian

 




Hi,

You compare the calculated (DateADD) date to Today. If that date >= today, then you kick off the order.

Skip,
[sub]
[glasses] [red][/red]
[tongue][/sub]
 
Thanks for responding so quickly.

I guess my question is more on how to get the calculated date.

If I use the startdate as my base date:
Dateadd(TimeUnit, startdate, TimeNum) then the date won't progress past the first order. How do I continue the process?
 
I think I might have figured it out

if
(DateDiff([timeunit],Date(),[startdate])) Mod [timenum]=0
Then ....'include order

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top