Compact command line failure

G

Guest

I have got a scheduled task set up designed to compact and repair my database.

In the Run box I have entered the following text:

K:\User\Aggregates\Live\Deductibles\NF_Catlin_Exposure_Management_1.2.mdb
/compact

I took the syntax directly from Access help.

However when the task runs all it does is open the database without actually
compacting it.

Could anyone please help?!

Thanks in advance.
 
D

Dirk Goldgar

Phil Davy said:
I have got a scheduled task set up designed to compact and repair my
database.

In the Run box I have entered the following text:

K:\User\Aggregates\Live\Deductibles\NF_Catlin_Exposure_Management_1.2.md
b
/compact

I took the syntax directly from Access help.

However when the task runs all it does is open the database without
actually compacting it.

Could anyone please help?!

Thanks in advance.

I believe you have to explicitly execute the msaccess.exe program, and
provide both the database path and the /compact argument on the command
line. E.g.,

msaccess.exe
K:\User\Aggregates\Live\Deductibles\NF_Catlin_Exposure_Management_1.2.md
b /compact

(all on one line in the Run box).
 
D

Douglas J. Steele

/compact is actually a command-line switch for msaccess.exe, so you need to
include that in your command line as well.

The actual command you need will depend on what version of Access you're
running (or, more accurately, where msaccess.exe is installed on your
machine), but it will take the form of:

"C:\Program Files\Microsoft Office.11\OFFICE11\msaccess.exe"
K:\User\Aggregates\Live\Deductibles\NF_Catlin_Exposure_Management_1.2.mdb
/compact

(all on one line, of course)

Note that you need quotes around the full path to the executable, since
there are spaces in the path name.

Also, you may want to take advantage of the fact that you can compact to a
different file. I'd create a batch file that renames the existing file and
compacts the renamed file to the "proper" file name. If something goes wrong
during the compact, you could end up hosing your database.
 
G

Guest

Awesome!

Thanks chaps it now works having put "C:\Program Files\Microsoft
Office\Office10.msaccess.exe" in front.

And the task icon has turned into the Access icon

Of course how would it have known previously?!

Many thanks for this!

Phil
 

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