Access 97 - Compact and Repair from within Database

  • Thread starter Thread starter Norma
  • Start date Start date
N

Norma

I am working in Access 97 and I need to compact and repair
the database from a button on the switchboard. I can
write a macro that will compact and repair, but only if
the database is not open.

I will appreciate any help I can get to get started in the
right direction. I am familiar with VB for apps.

Thank you,
 
I create a module and then copy this Sub:

Public Sub myCompactAndRepair()
Access.CommandBars("Menu Bar"). _
Controls("Tools"). _
Controls("Database Utilities"). _
Controls("Compact and Repair Database..."). _
accDoDefaultAction
End Sub


To use it, I have it respond to a click event from a
command button.

Private Sub cmdCompactAndRepair_Click()
Call Main.myCompactAndRepair
End Sub

Main is what I named my module.
 
Back
Top