How to tell if a query has run (1 Viewer)

ColinEssex

Old registered user
Local time
Today, 12:16
Joined
Feb 22, 2002
Messages
9,116
Hi All,
I would like to run a delete query automatically on the last day of the month when the database is opened. Thats fine but...the problem may occur that the user may not use the database on the last day, so it would need to run when the database is next opened.
Is there any way to tell if a query has run automatically? I must be a bit thick today!
Thanks in advance
Col
 

Fizzio

Chief Torturer
Local time
Today, 12:16
Joined
Feb 21, 2002
Messages
1,885
Hi Col,

Easiest ways are to have an audit trail of the query or a simple 1 field table. I would personally use a audit Trail. Create a Table with a Date field and to futureproof (Just in case you add more table changing queries) a QueryName field.
On your code where you run the query, initially check the date of the last query using a recordset & DMax function and if it does not meet a certain criteria eg, < 1/12 ago, run the query and add a new record to the Audit table. This will then not only run the query but also create an audit trail for you to monitor the run-habits of the query.

HTH
 

ColinEssex

Old registered user
Local time
Today, 12:16
Joined
Feb 22, 2002
Messages
9,116
Hi Fiz

Yep - That'll work fine AND I totally understand it. Brill job

Thanks

Col
 

Users who are viewing this thread

Top Bottom