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

Using a [Delete] Query

Status
Not open for further replies.

lisss001

Technical User
Nov 21, 2005
12
GB
I am attepting to create a query which is able to delete all records within a database which have a date stored in standard date/time format and of which are older then 365 days of the current date. I can imagine the delete setting to be something along the lines of: 365<date.now although this doesn't work. What expression would I use in a delete query to delete all records with a date longer then 365 days ago of the current date ?
 
You could try
<Day(Date())-365

Or
Year(Date())-1

Or
<DateSerial(Year(Date()),Month(Date()),1)
This last one would delete records prior to December 1 of 2005.

Tom
 
Thanks, I used this one: <DateSerial(Year(Date()),Month(Date()),1)
 
And what about this ?
<DateAdd('yyyy',-1,Date())

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top