Hi Everyone,

For a number of reasons, I have created an excel workbook that imports an access table. My VBA does the following

1. Open an access database containing one table
2. Export ranges from excel into access to create additional tables
3. Perform queries to create temporary tables
4. Export the end table
5. Delete all the temporary tables, leaving behind only the original table


This creates a fair amount of bloat in my file size and eventually, if not compacted and repaired, runs up against the 2 gb limit. To combat this, I set the access database to compact on close. This worked for a while, but now when I close the database, it give me an error message that the file is already in use. I have also tried opening the database exclusively, but to no avail. Lastly, I am the only user and this is not hosted on a shared network. An example of my code is below.
Please Login or Register  to view this content.

When I replace acc.closecurrentdatabase with acc.currentdb.close, I do not get an error, but the compacting does not work. Can anyone please advise?