Query records more than 30 minutes old

skwilliams

Registered User.
Local time
Today, 14:24
Joined
Jan 18, 2002
Messages
516
I have a table with records that I would like to run a append query which appends records to another table and deletes from this table if the status = "Complete" and the CmpltTime is >= 30 minutes. The CmpltTime is a default value based on the system time that is autofilled.

How can I set the criteria for >= 30 minutes?
 
You can add a field to the query using DateDiff() to calculate the minute difference, and put a criteria on that field. Archiving is typically not a good idea, and in this case you have the possibility that a record will become 30 minutes old between the append and the delete.
 
I tried using this query on the table without the append, just to see if the equation would work for me. I created a field in the query. This is the calculation.
Code:
Cur: DateDiff("nn",Now(),[CmpltTime])
After running the query, that new field says this: #Func!

What am I missing?
 
Use "n" instead of "nn"

Also is your field storing just a time or a date and time?
 
My only problem now is the criteria.
Code:
<"-60"
It removed some records from displaying such as a -82 but I have two records with -108 that are still showing.

Any ideas???
 
You wouldn't want the quotes in there, as the DateDiff should be returning a numeric value.
 
I've attached a zip file with a word document of screenshots showing the query design and results to better illustrate.
 

Attachments

I got it. It should have been > -60 since the values are negative. Thanks for the help!
 
Glad you got it sorted out.
 

Users who are viewing this thread

Back
Top Bottom