Access 2007 query question

User avatar
teachesms
2StarLounger
Posts: 170
Joined: 05 Feb 2010, 18:04
Location: Jacksonville, NC

Access 2007 query question

Post by teachesms »

I am at a loss this morning.

In a query how do I write the statement :

I am looking in a field that a request for something has been sent. I want to look up anything between the current date =NOW() and what has been requested during the last 7 days .

Something like BETWEEN (=NOW() and anything requested during the last 7 days)

no matter how I write it it doesn't happen.

one of those days.

thanks for looking at this and any advise!
If you can't convince them, confuse them - Harry S. Truman

Nannette

User avatar
HansV
Administrator
Posts: 78478
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Access 2007 query question

Post by HansV »

Try

Between Date()-7 And Date()
Best wishes,
Hans

User avatar
teachesms
2StarLounger
Posts: 170
Joined: 05 Feb 2010, 18:04
Location: Jacksonville, NC

Re: Access 2007 query question

Post by teachesms »

ah...thank you Hans. makes sense!

:)
If you can't convince them, confuse them - Harry S. Truman

Nannette

User avatar
HansV
Administrator
Posts: 78478
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Access 2007 query question

Post by HansV »

One thing to keep in mind: Between includes the lower and upper bounds. So if you want to select requests that have been sent less than 7 days ago, use

Between Date()-6 And Date()
Best wishes,
Hans

User avatar
Wendell
4StarLounger
Posts: 482
Joined: 24 Jan 2010, 15:02
Location: Colorado, USA

Re: Access 2007 query question

Post by Wendell »

Adding to Hans' caution - if you use Now() to populate the field you need to be aware that it includes the time as well as the date. Thus if you use Date() in your criteria, you may miss a record entered today.
Wendell
You can't see the view if you don't climb the mountain!