Compact and Repair Access Database.
-
I found this article which may interest you: http://support.microsoft.com/default.aspx?scid=kb;en-us;Q303528[^] I wrote a utility to compact an access database using some code that I had found somewhere. I referenced Microsoft DAO 3.6 Object Library Com object and then used the following code:
Private Sub CompactFile(ByVal strFileIn As String, ByVal strFileOut As String)
Try
'First check the file u want to compact exists or not
If My.Computer.FileSystem.FileExists(strFileIn) Then
Dim objDAO As New DAO.DBEngine()
'CompactDatabase has two parameters, creates a copy of compact DB at the Destination path
objDAO.CompactDatabase(strFileIn, strFileOut)
End IfCatch ex As Exception MsgBox("Compact File Error: " & ex.Message) End Try End Sub
Note: This method will save the compacted database under a new name. If you want it to appear that the file itself was compacted you will have to add code to delete the exising db and replace it with the compacted one after you perform this method. Hope this helps.