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

Rolling Date Queries

Status
Not open for further replies.

Soulbait

MIS
Mar 12, 2003
43
US
I have a database that I am designing, we need to be able to do a query on a rolling date

As in, my boss says, I want to know about the last 30 days, or last year

I was wondering if there is a way to just be able to go back 1 year or 1 month from the Current date. Without having to edit the date each time.

I want the users of the database to be able to do this with just a button on the form as well.

Also, I was wondering how to get it so it can count the amount of records received between two dates. I don't care about the information I just need it to give me a total of new records between Date1 and Date2

Thanks
 
Soulbait,
this example works for the past 30 days.
For the date try the following in your where clause:
WHERE (([Hours Table].Date) Between (Date()-1) And (Date()-30));
use the count function in you select statement to get the number of records inbetween the dates.
HTH

regards,

longhair
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top