Link to home
Start Free TrialLog in
Avatar of SteveL13
SteveL13Flag for United States of America

asked on

Compact and repair from command button Access 2010

I have a form which conatins a command button to compact and repair the database when the button is clicked.  It doesn't seem to work any longer with Access 2010.  Here is my code:

Private Sub Command111_Click()

    On Error GoTo Err_Command111_Click

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

Exit_Command111_Click:
    Exit Sub

Err_Command111_Click:
    MsgBox Err.Description
    Resume Exit_Command111_Click

End Sub

I need to be able to compact and repair using 2003 and 2010 (and 2007) with a command button.  How can I fix this?

--Steve
ASKER CERTIFIED SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial