Date Query

Anderson

Registered User.
Local time
Today, 13:52
Joined
Feb 14, 2009
Messages
12
Hi

Forgive me if this seems like a bit of a rookie question - I'm trying to write a query in access that will delete records that have an entry older than a certain date (eg older than 6 months)

If possible, I'd like to make it dynamic, so that when you run the query on any given day it removes records that have a date entry which is more than six months before the date on which the query is run.

Any ideas how I might go about making one?

Thanks in advance
 
Try

< DateAdd("m", -6, Date())
 
Access has a very easy to use, and intuitive query building grid. The first thing to do seeing you as you are venturing into deleting records territory! First thing is make a backup copy of your database. That's so if you manage to delete the wrong records, you have a backup database to fall back on.

Next experiment with the query building grid, first of all creates select queries that return records on a particular date, then use the different operators available to return dates older or younger than your key date (equals =, greater than <, less than >....) Once you have the query returning the right set of dates, then you can change the query into a delete query with the "query type" button in the ribbon. Run this query to delete the set of records returned.
 
That's brilliant, thanks for your help. Think I've got it working now
 

Users who are viewing this thread

Back
Top Bottom