Compacting a split database

  • Thread starter Thread starter Larry L
  • Start date Start date
L

Larry L

Access is noted for bloating a database, especially when you add and
delete records frequently. I have always had mine set to compact on close,
and that works great. Now after everyone's advice I split my database, so
the data is in a second (back-end) database with all the tables linked.
However, now when I close the database, it compavts the front end, since
that's what's open, and the back-end grows.

I now have to manually open and close the back-end just to compact it.
Surely there is a better way?

Thanks,
Larry L
 
You can use VBA code to compact the back-end.

Check whether the corresponding .LDB file exists. If it does, you're not
going to be able to do the compact. If it doesn't, rename the current
back-end as a backup, then compact the backup to the "correct" file name.

You can set a reference to DAO, and use the DBEngine's Compact method to do
this, or you can set a reference to JRO (Jet Replication Objects), and use
the JetEngine's CompactDatabase method.
 
Back
Top