Compacting Databases

A

Andi B

Hi folks,

Just a quick question - does anyone know if its possible to use a form
command button to make the database perform a compact operation, the same as
Tools > Database Utilities > Compact & Repair Database, only without the
database asking which file to compact from and to the way it does when the
DoMenuItem function is used.

Thanks in advance of any assistance,

Andi
 
6

'69 Camaro

Hi, Andi.

If you are using Access 2000 or later, then you may use the VBA code on the
following Web page:

http://www.mvps.org/access/general/gen0041.htm

If you are using Access 97 or earlier, then you can't compact the current
database. The database must be closed before it can be compacted. For some
excellent alternatives, please see the following Web page:

http://www.mvps.org/access/general/gen0013.htm

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)

- - -
When you see correct answers to your question posted in Microsoft's Online
Community, please sign in to the Community and mark these posts as "Answers,"
so that all may benefit by filtering on "Answered questions" and quickly
finding the right answers to similar questions. (Only "Answers" have green
check-marks.) Remember that the best answers are often given to those who
have a history of rewarding the contributors who have taken the time to
answer questions correctly.
 
L

Larry Daugherty

You can't compact a database while you have it open.

You can choose the option to compact on close.

HTH
 

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