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

A

Arvin Meyer [MVP]

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"
 
D

DDogCap

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'
 
Top