J
JT
I want to compact my database programatically after importing a large file.
I have the following code for when the user clicks on a Compact Database
button. I
am now getting a message that says:
"You can't compact the open database, while running a macro or Visual Basic
code.
Instead of using the macro or code, on the Tools menu, point ot Database
Utilities, and then click Compact/Repair Database."
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sub Compact_Database_Click()
CompactDB
End Sub
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Public Sub CompactDB()
CommandBars("Menu Bar"). _
Controls("Tools"). _
Controls("Database utilities"). _
Controls("Compact and repair database..."). _
accDoDefaultAction
MsgString = "The database has been compacted for better performance."
MsgBox MsgString, , "Database Compacted"
End Sub
Any suggestions or comments to alleviate this problem would be greatly
appreciated. Thanks for all of the help with this project.
I have the following code for when the user clicks on a Compact Database
button. I
am now getting a message that says:
"You can't compact the open database, while running a macro or Visual Basic
code.
Instead of using the macro or code, on the Tools menu, point ot Database
Utilities, and then click Compact/Repair Database."
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sub Compact_Database_Click()
CompactDB
End Sub
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Public Sub CompactDB()
CommandBars("Menu Bar"). _
Controls("Tools"). _
Controls("Database utilities"). _
Controls("Compact and repair database..."). _
accDoDefaultAction
MsgString = "The database has been compacted for better performance."
MsgBox MsgString, , "Database Compacted"
End Sub
Any suggestions or comments to alleviate this problem would be greatly
appreciated. Thanks for all of the help with this project.