Compact database

  • Thread starter Thread starter Markus Weber
  • Start date Start date
M

Markus Weber

Hello!

I just want to compact the current database as done when I use the
menu point to compact and repair a database. How can I accomplish
this?

Currently I find mthods only to compact other databases, but not the
current one itself.

Thanks in advanve!
 
Markus,

There's a very good reason for this! To compact a database, Access
actually closes it, compacts it into a new file, deletes the old file
and renames the new one the old one's name. Apparently you can't do all
that with code within the database itself - the last thing done will be
to close the original.
Some do it by forcing the execution of the menu item from code, but it
is not recommended, and it is practically not required either in the
sense that:
(a) if it is a single user database, or the front end of a multi-user
one, you can use Compact on Close which will do the job just fine,
without any programming, or any manual action required by the user;
(b) if it is the back end of a multi-user database, you don't do it from
within itself anyway, nor could you do it most of the time simply
because other users are logged in. In this case I would recommend a
scheduled job to do it automatically overnight, when no users are in.

HTH,
Nikos
 
hi Nikos,

you are right, so now I use the option you told (Compact on Close).
Thanks!
 
Back
Top