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

Use Odd Number of Days as Criteria 2

Status
Not open for further replies.

uncleG

Technical User
Jun 10, 2004
63
US
Below is a snippet from code I use to select records between a range of dates in a query.

Between #6/1/2005# And #9/1/2005#

What would I enter to select all records in lets say the last 321 days or 196 days ?

Thanks, uncleG
 
There are numerous ways which I think you will be able to work out for yourself once you know a little about how Access stores dates.

Dates data type is just like the double data type. The integer part is the number of days since 1-Jan-1970 (from my memory - could be wrong) and the decimal part is the current second of the day since midnight expressed as a fraction of 1 day (i.e. seconds since midnight / 86400)

So CDate(Int(Now) - 321) represents the date at midnight 321 days ago.

 
all records in lets say the last 321 days
>=Date()-321

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks, PCLewis I played with it over coffee and the light came on.
Thanks, PHV , short, direct and as always to the point.
UncleG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top