J
JT
I want to enable users to compact a database after importing a large file.
Below is the code 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.
Below is the code 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.