Can you disable Compact on Close in code?

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

I have an mdb application set to 'Compact on Close' in the Tools - Options
dialog. I'm also using 'DoCmd.Quit acQuitSaveNone' to close the application
upon certain events. There are times, however, when I don't want the file
to compact and repair itself when it closes, but rather just close down
without compacting.

Is there a way to turn off the 'Compact and Repair' setting in VBA code?

Thanks in advance,

Paul
 
Hi Paul

Call SetOption("Auto Compact",False) will turn the option off.

It will not revert to its old state automatically the next time the database
is opened, so if you want it turned on by default then add
Call SetOption("Auto Compact",True)
to your startup code.
 
Great!

Thanks, much, Graham. And thanks for the tip about turning it back on.

Paul


Graham Mandeno said:
Hi Paul

Call SetOption("Auto Compact",False) will turn the option off.

It will not revert to its old state automatically the next time the
database is opened, so if you want it turned on by default then add
Call SetOption("Auto Compact",True)
to your startup code.

--
Good Luck :-)

Graham Mandeno [Access MVP]
Auckland, New Zealand

Paul said:
I have an mdb application set to 'Compact on Close' in the Tools - Options
dialog. I'm also using 'DoCmd.Quit acQuitSaveNone' to close the
application upon certain events. There are times, however, when I don't
want the file to compact and repair itself when it closes, but rather just
close down without compacting.

Is there a way to turn off the 'Compact and Repair' setting in VBA code?

Thanks in advance,

Paul
 
Back
Top