Compact and Repair a database from a macro in a different database

  • Thread starter Thread starter DDogCap
  • Start date Start date
DDogCap said:
Can it be done?
Access 2007 - thanks!

I don't think that you can do it with a macro, but in VBA code, the syntax
would be similar to:

DBEngine.CompactDatabase "C:\FolderName\DBName.mdb",
"C:\FolderName\DBName.mdb"
 
Hmmm tried that using the RunCode command in a macro but it didn't work.

DBEngine.CompactDatabase "C:\Documents and Settings\Import Parts.mdb",
"C:\Documents and Settings\Import Parts.mdb"

Got an error: can't find the name 'DBEngine'
 

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

Back
Top