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

30, 60 and 90 day query?

Status
Not open for further replies.

reb0101

Programmer
Oct 29, 2006
3
0
0
US
any and all help will be much appreciated on this one.
I’m not real good and the date queries so here goes.

I have a products table with several fields and one of them is receive date which
is the date the product is received and put on the books.
What I am trying to do is be able to write a query that will produce the products that have a ‘shelf life’ of one year and the query will show me the products that are 90, 60 and 30 days ‘out’ from being on the shelf for one year.

Say ‘product 1’ is put on the books and entered into the Access table on Jan 01, 2007.
I need it to take that date and essentially ignore it until the query is run on October 01.
Only then will a product even show up in the query results because on October 01 it will have 90 days left before a year.
Then 60 days on November 01 and 30 days on December 01.
any ideas ?
 
Put that as a field in your query and filter records to be between 30 and 90

x = (12 - DateDiff("m", [Received_Date_Field], Date)) * 30
 
SQL snippet:
WHERE Int(DateAdd('yyyy',1,receive date])-Date()) In (30,60,90)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top