Compact and repair using VBA

D

Dave

Hi

Can someone tell me what the VBA is if I want to start off a compact and
repair. I want to put it behind a button on a form.

Thanks for any help

Dave
 
A

AB

This function will compact and repair

Function CompactDatabase()

CommandBars("Menu Bar").Controls("Tools").Controls("Database Utilities"). _
Controls("Compact and repair database..."). _

accDoDefaultAction

End Function
 
C

Chris Reveille

You cannot compact the database you have open from code.
You can check the "Compact on Close" check box in the
tools/options area

Chris
 
D

Dave

Thanks AB.
That worked just great :)

Dave

AB said:
This function will compact and repair

Function CompactDatabase()

CommandBars("Menu Bar").Controls("Tools").Controls("Database Utilities"). _
Controls("Compact and repair database..."). _

accDoDefaultAction

End Function
 
Top