Compact Database

Kinger43

racecar driver
Local time
Today, 16:39
Joined
Aug 17, 2007
Messages
226
There is a command CompactDatabase in the DoCmd.RunCommand action. I tried to use it in a macro to compact my database every so often but it gave me an error saying that you can't compact a database from a macro or VB code. My question is, what is the point of making this command available if you can't use it?
 
I use
DoCmd.RunCommand acCmdCompactDatabase
in a 'Close Form' event and it works fine.

Does it have to be run from a macro?
 
I would like it to come from a macro because I already have the macro built and its fairly complicated. I am fairly new to access and have just started really using code instead of umpteen thousand macros and this was one of the first ones I made. It doesn't really matter though because I can write the code and call it from the macro. Maybe it has something to do with the close form event.
 
I love it when my posts from 10 months ago are relevant! :P (That just doesn't happen too often.)
 
Just an A2K7 update of that code - Use FMC instead of TDC if you have Access 2007
 

Users who are viewing this thread

Back
Top Bottom