Compact and Repair Database

  • Thread starter Thread starter Rsharkey
  • Start date Start date
R

Rsharkey

How do I set up the compact and repair database
automatically using the runcommand macro? The macro
requires to closed the database inorder to run.
 
Tough luck! Command compact only works for another, closed
database, not the one it's run from (this applies to both
Macro and VBA).
The only alternative I know of is to use SendKeys to run
it from the menu... but SendKeys can be tricky, and should
be avoided to the extent possible.
When faced with the same problem, I ended up writing a
small VB application (self-contained .exe) which first
compacts the database and then opens it... but you'll need
VB for this, VBA is not capable of producing executable
files.


Nikos Y. (nyannaco at in dot gr).
 
You cannot Compact & Repair an Access database from a macro or code.
You can Compact & Repair on exiting the database. this is done b
checking the box in the Tools/Options, Genearal tab labled Compact o
Close (in Access 2000
 
You cannot compact an open database using a macro or code. You ca
however, in the Tools/Option general tab compact on close.

Good Luc
 
Back
Top