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

Compacting from another dbase...

Status
Not open for further replies.
May 9, 2000
446
GB
Okay so i have a front end and a backend. yThe back ends growing quite quickly but compacting it makes a huge difference. In my front end i have a form that opens when the database is opened.

I was wondering if its possible to use the DBEngine.Compactdatabase method in the forms OnOpen event to compact the backend (which i've done) but without renaming the backend database in the process? Anyone know
Cheers
 
How I think this can be done is by DBEngine.CompactDatabase but you will have to rename it. Then Kill the original name of the database and again rename the database back to the original name. Something Like:

Code:
If Dir(&quot;MyCompactedDb.mdb&quot;) <> &quot;&quot; Then _
		Kill &quot;MyCompactedDb.mdb&quot;

DBEngine.CompactDatabase &quot;MyDb.mdb&quot;,&quot;MyCompactedDb.mdb&quot;

Name MyCompactedDb As MyDb

The trick is that your backend cannot be already open (That means that you cannot have any bound front end forms either) This can prove to be quite a problem. You will have to find a time where no one is using the database and make sure the form that is calling this procedure is not a bound form.

I hope this helps,
Rewdee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top