query to retrive all orders made within the last 7 days

marky_dp

Registered User.
Local time
Today, 11:53
Joined
Jan 5, 2006
Messages
24
Hi, I wonder if any one could help me with what I think is a simple query.

I would just like to show all the orders thats have been made within the last 7 days.

So far I can retrieve all the orders made today, by using 'Date()' as my criteria, but cant figure out what criteria to use for the last 7 days. It would also be good, if i could figure out how to retrive all orders made within the last month, and as well select all orders made between two specific dates.

Regards
 
Ken is write but I think he meant >=Date()-7
 
Ok, so retrieving the dates for the last 7 days and 30 days is easy enough, but how would you retrive all orders made within the last calendar month?
 
I would simply have the user prompted for the date to go back to...
 
Hmm... I would look at how to split up the Date() into days, months etc. Then once you have that, store the days, then do Date()-days (or possibly Date()-(days-1)
 
Hi -

To return all records from the current month, place this in the criteria cell of your date field:
Code:
Between DateSerial(Year(Date()),Month(Date()),1) And Date()

To return all records from month previous to the current month, place this in the criteria cell of your date field:
Code:
Between DateSerial(Year(Date()),Month(Date())-1,1) And DateSerial(Year(Date()),Month(Date()),0)

Added:
Additionally, you might want to take a look at this post http://www.access-programmers.co.uk/forums/showthread.php?t=104911 which provides a method for specifying any mm/yyyy as your query criteria.

HTH - Bob
 
Last edited:
Nice one raskew, thanks very much for your help, you've sorted me ouit a treat. Cheers
 

Users who are viewing this thread

Back
Top Bottom