Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compact an Access 2007 database

Status
Not open for further replies.

bcooler

Programmer
Jun 13, 2009
132
Hello all!

I have created a few multi-user 2007 databases. I have always chosen the "Compact and Repair" option on close to prevent bloat. However, on occasion, the .accdb file will be missing, but a "database.mdb" will appear causing everyone's file links to quit working until I rename the file.

After a bunch of searching I found out the following:

1.) This happens when multiple people are using the database and someone tries to compact it on close, causing the command to fail.

2.) Some suggest not to do this because problems like a full hard drive and not being the only person in the database could cause corruption. Their suggestion is to manually compact routinely.

3.) I know that I'm too lazy to remember to compact all these databases with any regularity.

With that said, can someone point me to a solution that is bulletproof? I'm not sure how to execute, but would a command line combined with a Windows scheduled task get the job done (at low usage times like 3AM)? I found this code at


but have no idea how to use it and if it will work.

Code:
expression.CompactDatabase(SrcName, DstName, DstLocale, Options, password)


Thanks!
 
If this was employed correctly this would not be an issue. The backend is on the server holding only tables. Every user has a frontend with code, forms, reports, and queries. Any other employment is incorrect. All front-ends compact on close. Back end rarely if ever needs compacting and should be done by the administrator anyways not on close.
 
Thanks for the courteous response. Have a great day.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top