Compacting the current db

P

Pete

All internet subject info informs that the current DB
cannot be compacted unless it is closed and exersised
from an external DB.
How then, does the 'Compact Database' option under
Tools|Database Utilities manage to compact the current db?

I note that a second db file (db1.mdb) is momentarily
created during the process.

Is it possible to replicate this functionality within the
current db using vba?

Many thanks.
 
T

Terry

i am querying the same thing. I believe you can use
hidden system commands. If you see my note "Hidden System
Commands"
 
P

Pete

Many thanks for the reply Doug.

I am still curious as to how the 'Compact Database' built-
in menu option manages this task on the current database?
 
B

Bruce M. Thompson

I am still curious as to how the 'Compact Database' built-
in menu option manages this task on the current database?

It closes the current database before compacting and then reopens it. Access
doesn't use VBA to perform this task.

There is a way to perform the same task using "SendKeys()", but, due to the
problems that can present, I won't even go there. It's much better to go the
route of TSI SOON, as Doug suggests.
 
R

Roger Carlson

Access doesn't use VBA to do the compacting.

On my website (see sig below) is a small sample database called
"CompactDatabase2k.mdb" which illustrates how to do this through code. It
is much safer than the CompactOnClose feature because it makes a back-up of
the database before compacting it. If anything goes wrong, you can easily
recover the uncompacted database.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top