Compact & Repair

carrietm
2StarLounger
Posts: 110
Joined: 08 Mar 2011, 13:18

Compact & Repair

Post by carrietm »

Is there a way to have the database run through the "compact & repair" process before closing the database?

User avatar
HansV
Administrator
Posts: 78396
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Compact & Repair

Post by HansV »

You can set a database to compact itself automatically when it's closed.

In Access 2010: activate the File tab of the ribbon, then click Options.
Click Current Database in the navigation pane on the left hand side.
Tick the check box "Compact on Close", then click OK.

In Access 2007, click the big Office button, then click Access Options.
Click Current Database in the navigation pane on the left hand side.
Tick the check box "Compact on Close", then click OK.
Remark: Compact and Repair is, er, slightly quirky in Access 2007. Make sure that you always have a backup.

In Access 2003 or earlier, select Tools | Options...
Activate the General tab.
Tick the check box "Compact on Close", then click OK.

Remark: if several people use the same database, Compact on Close can be dangerous - if someone opens the database just after another user has closed it, the database may be halfway through the compact process. As a result, you may end up with two copies of the database: the old, uncompacted version and a new compacted one. If you have a split database design where each user has an individual copy of the frontend, this problem won't occur.
Best wishes,
Hans