Print Page | Close Window

CompactDatabase.mdb (advanced)

Printed From: Roger's Access Library
Category: Roger's Access Library
Forum Name: Roger's Download Samples
Forum Description: A compendium of Microsoft Access 97 and 2000+ routines, each separated into its own sample database.
Printed Date: 01 Jun 2023 at 7:46am
Software Version: Web Wiz Forums 12.03 -

Topic: CompactDatabase.mdb (advanced)
Posted By: Roger Carlson
Subject: CompactDatabase.mdb (advanced)
Date Posted: 01 Aug 2008 at 7:16am

Please consider donating $1 per sample downloaded, - find out why here .


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".) 

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.
Access 97 (46 KB): -
Access 2000 DAO (105 KB): -

Consider donating $1 per sample downloaded," rel="nofollow - find out why here .<

Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.03 -
Copyright ©2001-2019 Web Wiz Ltd. -