How can i automate Compact and Repair ?

S

Steinarr.G.

I have few databases that get big.. some contain logs and info for
statistics..
I need to compact the database every one and a while..

How can i automate it ..

Regards.
Steinki.
 
T

Tony

Click on Tools, then Options, then click the "General"
tab. There's a check box labeled "Compact on Close".
Click on that and each time the file closes, it will
compact automatically.

Hope that helps.
TOny
 
S

Steinarr.G.

This i know =)

I´m thinking about how can i script it and run in in
scheduled task.

Regards.
Steinki
 
G

gary

Hi there.

I am working on a method now for automatically compacting
and repairing. The start is Microsoft Article 304408
You use this to close out all front ends of your database
so that no one is using the database. I intend to use
windows scheduler to do this in the middle of the night.
I will open a small database that will change the name of
the file (see article). Then the databases will close
out. The scheduler will run another database that will
execute the
application.compactrepair "filename" command to compact
and repair the backend.
I have tested this and it seems to work well.
Hopefully this helps.

Gary.
 
J

Jeff Mastey

Create a batch file containing a command for the Access executable, followed
by the path to the database you want to compact, then the /compact switch.
For example:

"C:\Program Files\Microsoft Office\Office 11\MSAccess.exe" C:\Work\Work.mdb
/compact

Quotes are required if the path name contains spaces. After you create the
batch file, just use Windows task scheduler to schedule execution. You'll
want to make sure it's at a time when no one is using the database,
obviously. The /compact switch defaults to keeping the file name the same,
so if you want to rename it, you'll have to type the new path and file name
after the switch.

For a complete list of switches and their uses, do a search in Access help
for "startup command-line options".
 
Top