Roger's Access Library Homepage
Forum Home Forum Home>Roger's Access Library>Roger's Download Samples
  New Posts New Posts RSS Feed: CompactDatabase.mdb (advanced)
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

CompactDatabase.mdb (advanced)

 Post Reply Post Reply
Author
Message / View First Unread Post
Roger Carlson View Drop Down
Microsoft MVP
Microsoft MVP


Joined: 20 Feb 2008
Online Status: Offline
Posts: 218
Post Options Post Options   Quote Roger Carlson Quote  Post ReplyReply Direct Link To This Post Topic: CompactDatabase.mdb (advanced)
    Posted: 01 Aug 2008 at 3:16pm

This sample illustrates how to compact the current database programmatically.  It  assumes that the tables reside locally.  (To compact a Back-end database, see my sample "CompactBackEndDB.mdb".) 

Overview:
1) Create a new, temporary database
2) Copy several pre-created forms, macros and modules to this temp database
3) Close database and launch temporary database with the /x switch which initiates the compact process.
4) After compacting is done, close temp database and relaunch main database

This can be used to safely duplicate the buggy "Compact on Close" feature of Access 2000, because it makes a back-up of the database before compacting it.  If anything goes wrong, you can easily recover the uncompacted database.
 
Download
Access 97 (46 KB):
CompactDatabase97.zip
Access 2000 DAO (105 KB): CompactDatabase2k.zip

Please consider donating $1 per sample downloaded, find out why here.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down