I would like to 'compact and repair' the database using VBA code so that I would not have to rely on the user to do this. Can anybody provide the code necessary to do this.
Since office (access) 2000 it is possible to use hidden interface IAccessible to compact DB on demand, by code:
Code:
Sub CompactThisDB()
Dim conCompact As Office.CommandBarControl
Set conCompact = CommandBars.FindControl(Id:=2071)
conCompact.accDoDefaultAction
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.