Compact Database via VBA

Discuss Compact Database via VBA in the Microsoft Access Development forum on Dev Articles. Compact Database via VBA Microsoft Access Development forum to discuss problems and solutions with this popular DBMS. Use Access to build and modify database tables, or full-featured applications.

1. Add a reference to "Microsoft Jet and Replication Objects 2.6 Library"
2. Check if the database is in use , display a warning.
3. Create a temporary folder and copy the DB
4. Create an object of JRO JetEngine and call the compact method , to compact the tempdb and replace at the original location. After compacting delete the temp folder along with its contents.