Access 97 - Compact and Repair from within Database

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,
 
M

Michael San Filippo

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.
 

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

Similar Threads


Top