Compact & Repair another database using shell

A

Adam Thwaites

If I type this in the run box it works fine:

"C:\Program Files\Microsoft Office\Office11\msaccess.exe" "C:\Database\PAF
Address A-C.mdb" /compact

How ever If I try and run it in VBA using the shell command it doesn't do
anything:

Shell "cmd.exe 'C:\Program Files\Microsoft Office\Office11\msaccess.exe'
'C:\Database\PAF Address A-C.mdb' /compact"

Is there something wrong with my code?
 
S

Stefan Hoffmann

hi Adam,

Adam said:
How ever If I try and run it in VBA using the shell command it doesn't do
anything:

Shell "cmd.exe 'C:\Program Files\Microsoft Office\Office11\msaccess.exe'
'C:\Database\PAF Address A-C.mdb' /compact"
Why are you trying to run it in a separate cmd process?

Is there something wrong with my code?
Removing the cmd.exe shoudl be sufficent.


mfG
--> stefan <--
 
D

Douglas J. Steele

Stefan Hoffmann said:
hi Adam,



Why are you trying to run it in a separate cmd process?



Removing the cmd.exe shoudl be sufficent.

Will the single quotes work with Shell? He might need to use

Shell """C:\Program Files\Microsoft Office\Office11\msaccess.exe"" " & _
"""C:\Database\PAF Address A-C.mdb"" /compact"
 
A

Adam Thwaites

Sorted, thanks!

Shell """" & "C:\Program Files\Microsoft Office\Office11\msaccess.exe" &
"""" & " " & """" & "C:\Database\PAF Address R-Z.mdb" & """" & " /compact"
 

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