VBA CompactRepair


Access CompactRepair Method Example

CompactRepair Method – Compacts/repairs the specified database (.mdb) or Microsoft Access project (.adp) file.
Returns a Boolean – true if the process was successful.


Expression.CompactRepair (SourceFile, DestinationFile, LogFile)


Expression is a variable of type ‘application’ or the word application.

Sourcefile is full path and filename of the database to be compacted.

DestinationFile is the full path and filename of the resulting database file.



The compact repair command is of marginal usefulness because you can’t compact/repair the currently opened database.


Microsoft Office VBA, MS Access 2003, 2007, 2010, 2013, 2016