6 replies
by mcorr
You can use any scheduler to call a command line like "c:\...\msaccess.exe dbname.mdb /compact". I use Norton Antivirus' scheduler to compact several databases on a scedule.
Do you mean automatically compact when you open? This would be a problem is a multi-user database. You might be able to use the compactDatabase method, but it only works on closed databases.
Chris
by cswearingen
Try going into your database and Choose Tools > Options > General Tab > Compact on Close Checkbox. This works well.
Joshua L. Miller
Summit Computer Systems
by cswearingen
by birk
Here is Access code to compact a database that you can put in the application Close event (or any other place you want to use it):
current$ = "c:\enrollmenttempdump.mdb"
temp$ = "c:\\enrollmenttdsmall.mdb"
DBEngine.CompactDatabase current$, temp$ ' _ compact tempdump to temp$
Kill current$
Name temp$ As current$
current$ references the MDB file you want to compact; temp$ is a temporary file it gets compacted to. If the MDB file to be compacted is big or highly fragmented you might want to change the cursor to an hourglass during the compacting process. Also, the MDB file has to be closed because this code deletes it.
by cswearingen
This discussion is closed to new replies.
Trending Web Development posts
Sort by Trending