By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,073 Members | 1,253 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,073 IT Pros & Developers. It's quick & easy.

compacting access database from VBA code

P: 23
I have an access database with some VBA code. The vba code is started by a macro and basically deletes rows from tables and loads new data from an external file. After that VBA code has run I would like the macro to compact the database so I used the RunCommand--> CompactDatabase, but it didn't do anything. Everything worked as expected but the database was not compacted and I received no error message. What did I do wrong?
Jan 23 '08 #1
Share this Question
Share on Google+
1 Reply


ADezii
Expert 5K+
P: 8,679
I have an access database with some VBA code. The vba code is started by a macro and basically deletes rows from tables and loads new data from an external file. After that VBA code has run I would like the macro to compact the database so I used the RunCommand--> CompactDatabase, but it didn't do anything. Everything worked as expected but the database was not compacted and I received no error message. What did I do wrong?
You cannot Compact an 'Open' Database via a Macro or VBA code. Why not set the: Tools ==> Options ==> General ==> Compact on Close Option?
Jan 23 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.