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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Programatically Compact Database on Exit

Status
Not open for further replies.

BibleMan

Technical User
Jun 25, 2003
9
0
0
US
I have a database with multiple persons entering data on, residing on a Network drive with limited space.

I have a button on the form that exist the database and MS Access. I would also like it to Compact the database on the way out.

Is there a way to do this?

Thanks.

Joe
 
Joe, up in the menu, go to Tools, Options, then under the General Tab you will see a box that says "Compact on close" check the box. When access is close it will automatically compact your DB.


Herd.....Gary
 
Woo... if you have multiple users that will be tricky.

You dont want to compact when others are still in it.

Consider scheduling it or after everyone is out.

Something like this:
Private Sub Command1_Click()
DBEngine.CompactDatabase "c:\myDir\db1.mdb", "c:\myDir\db2.mdb"
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top