Automise Compacting a Database

flip_33_

New Member
Joined
Mar 5, 2003
Messages
42
Hi Everyone.

I have a database which I have designed that many users have access to, so it gets quite large very quickly...Does anyone have any code that will result in the database compacting evertime a user opens it or closes it.
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
No code is necessary.

Go to Tools | Options.
On the General tab, there is a check box for "Compact on Close". Simply check that box.
 
Upvote 0
You have to be careful with this, though, with multiple users. If someone exits the database, then the database begins the Compact and Repair. If someone else opens the database file while it is in the process of Compacting/Repairing, then the db will copy itself, name the new, Compacted copy "DB1", and the original will not be Compacted/Repaired. I've had cases where, within 5 minutes, I had 4 or 5 copies of the same database within the same folder (DB1, DB2, DB3, etc.) because of users entering/exiting the db simultaneously! Because of this, I don't use the Compact On Close option; I just do it myself manually once a week or so.
 
Upvote 0
I guess I haven't experienced that to be much of a problem because my database only takes 15 seconds to close. I get a copy every once in a while, but simply delete when I am backing up the database to another server.

I guess it really depends upon how big the database is, and how many people are using it.
 
Upvote 0

Forum statistics

Threads
1,221,550
Messages
6,160,459
Members
451,648
Latest member
SuziMacca

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top