Run on startup and use a query to find records to change?

Jeff4505

New member
Local time
Today, 08:09
Joined
Mar 1, 2005
Messages
5
Hi,

I need to create a macro to run upon opening a database and to then find all "members" with a "last active" date that's greater than 2 years ago and to change their "status" to "inactive".

Do you know how I would go about doing this? Would I create it to do each member one by one, or would there be an easy way to change them all?

Thanks
 
Easy I think. Im not to good with dates but there will be help around here you will find with a search.

Code:
sSql = "UPDATE membersTable SET status = 'inactive' WHERE lastActive < #" & now() - [I]2 years[/I] & "#;"
currentdb.execute sSql

the date syntax will need to be looked into.
To run this on startup I think a call to this module needs to be placed in a form_Load event.
 

Users who are viewing this thread

Back
Top Bottom