Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

preventing Autoexec macro from running after Compact & Repair

Seems such a simple thing, but I can't find the answer anywhere.

Every time I Compact & Repair, my Autoexec macro runs again. Is there a way to prevent it from running here, as part of the reason for compacting is to get the file size back down again after the Autoexec has deleted a lot of rows.

like image 201
Wilskt Avatar asked Dec 18 '25 04:12

Wilskt


2 Answers

You could rename the macro when you don't want it to operate as an autoexec macro.

DoCmd.Rename "disableAutoExec", acMacro, "AutoExec"

And rename it back to AutoExec when you do want it to behave as an autoexec macro.

If that suggestion isn't satisfactory, you could have the macro check for the presence of a file, disableAutoExec.txt, and do nothing when that file exists.

Delete the file when you do want AutoExec to do everything it's set up to do.

Or instead of a file as a flag to control whether AutoExec should proceed, you could store the flag value in a table.

like image 147
HansUp Avatar answered Dec 20 '25 10:12

HansUp


an old one that works (in MS Access 2010 and before at least) is to hold down the shift key when opening the database

like image 44
user3484244 Avatar answered Dec 20 '25 09:12

user3484244



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!