Unable to run acCmdCompactDatabase

G

Guest

I want to automate the compact database process with VBA code
DoCmd.RunCommand acCmdCompactDatabase. All I get is an error message telling
me to run this function from the toolbar manually.

How do I automate so it runs on closing the database?
 
D

Douglas J Steele

What version of Access are you using? All versions since Access 2000 allow
you to set a Compact On Close property under Tools | Startup
 
D

Dane Cooper

Douglas:

I am running Access 2003, and this option isn't available under Tools |
Startup. Am I missing something?

Dane
 
D

Douglas J Steele

Sorry, I only have Access 97 installed on this machine, so I can't
double-check exactly where on the form it is. Have you looked under
Advanced?
 
D

Douglas J. Steele

My fault. It's on the General tab under Tools | Options.

Note that this is setting is for all databases, not just one.
 

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