I am just looking for some more information/insight recarding the compacting of a database. I have always compacted the old fashion way and was looking to automate the process a little. I have several front end databases and I am looking to have each persons database compact when the close the database.
I have searched the faq and other posts regarding this topic and found some interesting information - I found the following code in a previoius post:
Public Function MyCompDb()
On Error GoTo MyCompDb_Err
SendKeys "%(tdc)", False
MyCompDb_Exit:
Exit Function
MyCompDb_Err:
MsgBox Err.Number & " : " & Err.Description, vbCritical, "Unexpected Error"
Resume MyCompDb_Exit
End Function
I placed this code in a module and tried calling it in the onclose event of the main form that is used.
I was looking for any input on a better place to house this code? Also, when a database is compacted, I understand Access copies then deletes the database but renames the new database the same as the old name (seemless) But I saw some information that indicated that you could not compact a database while it is open. I don't understand that as you are in the database even when you chose to manually compact via Tools/Database Utilities.
Any feedback/information would be greatly appreciated!
Thanks!
Fred
I have searched the faq and other posts regarding this topic and found some interesting information - I found the following code in a previoius post:
Public Function MyCompDb()
On Error GoTo MyCompDb_Err
SendKeys "%(tdc)", False
MyCompDb_Exit:
Exit Function
MyCompDb_Err:
MsgBox Err.Number & " : " & Err.Description, vbCritical, "Unexpected Error"
Resume MyCompDb_Exit
End Function
I placed this code in a module and tried calling it in the onclose event of the main form that is used.
I was looking for any input on a better place to house this code? Also, when a database is compacted, I understand Access copies then deletes the database but renames the new database the same as the old name (seemless) But I saw some information that indicated that you could not compact a database while it is open. I don't understand that as you are in the database even when you chose to manually compact via Tools/Database Utilities.
Any feedback/information would be greatly appreciated!
Thanks!
Fred