Compact and repair using VBA

  • Thread starter Thread starter Dave
  • Start date Start date
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
 
This function will compact and repair

Function CompactDatabase()

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

accDoDefaultAction

End Function
 
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
 
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
 
Back
Top