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

Query by date

Status
Not open for further replies.

kdoran

Technical User
Mar 23, 2003
88
US
I have been looking and unable to find out how to run a query that will look at a date field and find dates within a set number of days for example last 30 days or last 365 days from today etc... I am looking to run a report that will generate this and only get the entries from the last (fill in the blank) days.

Any ideas?

Thanks in advance,

Kelly
 
Hey Kelly,

Use the the DateAdd() function to return the date relative to another date.

DateAdd(interval, number, date)

 


Hi,
Code:
between DateField and Date()+FillInTheBlank


Skip,

[glasses] [red]Be Advised![/red] Coeds studying ancient Egyptian plumbing, might be known as...
Pharaoh Faucet Majors [tongue]
 
In fact, in the criteria cell of [Date field]:
Between Date()-(fill in the blank) And Date()

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Well I have been trying to get these to work but i do not know sql. and the dateadd does not fit what i want to do as I don't want to add a date but retrieve numerous dates.

I was also looking at 'HAVING () < Date()-365' but not sure how to use?

any ideas, i've been banging my head on this.

Kelly
 
In fact, in the criteria cell of [Date field]:
Between Date()-(fill in the blank) And Date()
Hope This Helps, PH.

i will try this out
 
Thanks for the help, my head feels better now (low watt lightbulb inside).

In fact, in the criteria cell of [Date field]:
Between Date()-(fill in the blank) And Date()

worked out great!

Kelly
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top