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
 

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

Top