mulhearn22
10-11-2007, 04:46 AM
Hey!
I need my Access DB to automatically delete records on every Wednesday. Any idea how to do this? It's on a running server.
TIA
Matt
llkhoutx
10-12-2007, 05:36 AM
Use the On Timer event, executed hourly, of your main switchboard to check the day of the month, if a Wednesday, delete the requisite records.
I say execute the event hourly, maybe more frequently, because who knows when the program will be opened. Also keep a log of to veryiof when last deleted so that only one deletion a week occurs.
The frequent testing is insignificant time wise.
aikea
10-13-2007, 02:24 AM
Create a query contains only records you want to delete. Run it and check the result.
The create a delete query, copy paste the SQL created in the last query then run it.
Use Day() function to get name of the day.
---------
Sorry, I misinterprete your question. There is no good way to run a background program in Access. You can try write some code in AUTOEXEC module. That module will load during start up. Create a hidden form with a timer control.
Pat Hartman
10-13-2007, 08:03 PM
Timer controls are not really appropriate for this task since they still require the database to be open in order to run.
I would create a query that deletes the desired records and a macro to run it - yes there are occassionaly reasons for using macros:) I would then create a batch file that runs the access database and passes in the name of the macro. This will cause the database to open and run that specific macro - don't forget to have the macro close the database as its last step. Then have the Windows scheduler schedule the batch file to be run some time in the wee hours on Wednesday.