Dear all,
My aim is to compact and repair current database, I got the following code
from http://www.mvps.org/access/general/gen0041.htm
Option Compare Database
' ***** Code Start *****
Public Sub CompactDB()
CommandBars("Menu Bar"). _
Controls("Tools"). _
Controls("Database utilities"). _
Controls("Compact and repair database..."). _
accDoDefaultAction
End Sub
' ***** Code End *****
'-----------------------------------------------------
'then I made a form, and a command button "command1"
Private Sub command1_Click()
Call CompactDB
End Sub
'-------------------------------
but when I click on the command button, there occured a error message no. 5.
something like "invalid process ...."
where I made mistake?