Deleting records that are 10 minutes old

mike wild

Registered User.
Local time
Today, 20:28
Joined
Feb 16, 2003
Messages
69
I have a table with a a time/date field.

Is it possiable to delete every record that is 10 minutes old?
 
Assume you'd want to delete all records that

are >= 10 minutes. If so, here's an example

based on Northwind's Orders table.

!!CAUTION: Don't run it or you'll end up with an
empty Orders table!!


This is intended to give you a template to work with.

To test it,

1) Make a back-up copy of your target table.

2) Modify the query-SQL to include the back-ups table namd and date-field name.

3) Run the query against your back-up copy.
Code:
DELETE Orders.*

FROM Orders

WHERE (((DateDiff("n",[OrderDate],Now())>=10)=True));

HTH - Bob
 
Append Query Willwork?

Question, will something like this work on a query? I have an append query to eliminate items that are qty=0, but when I run it will check for duplicates, which I can't have. How could I do so it would transfer only records with qty=0 w/out checking for duplicates all the time? I will never have duplicates that are qty=0 since they moved out on the first append. Did I make it clear? Sorry if not....
raskew said:
Assume you'd want to delete all records that

are >= 10 minutes. If so, here's an example

based on Northwind's Orders table.

!!CAUTION: Don't run it or you'll end up with an
empty Orders table!!


This is intended to give you a template to work with.

To test it,

1) Make a back-up copy of your target table.

2) Modify the query-SQL to include the back-ups table namd and date-field name.

3) Run the query against your back-up copy.
Code:
DELETE Orders.*

FROM Orders

WHERE (((DateDiff("n",[OrderDate],Now())>=10)=True));

HTH - Bob
 
I keep getting an error and the "n" is highlighted.

parentenethess orror
 
DELETE Orders.*
FROM Orders
WHERE DateDiff("n",[OrderDate],Now())>=10;

I like it clean, try that...

Regards
 
this is what i have so far

dbs.Execute "DELETE * FROM list WHERE DateDiff("n",[omit12],Now())>=50"

and the code stops on the "n"
 

Users who are viewing this thread

Back
Top Bottom