Compact and Repair Database

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.
 
N

Nikos Yannacopoulos

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).
 
J

Jim/Chris

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
 
J

Jim/Chris

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top