compact an access database from a batch file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Powabunga_
Posts: 1
Joined: 11 Jul 2016 09:36

compact an access database from a batch file

#1 Post by Powabunga_ » 11 Jul 2016 09:40

I need to call some visual basic script in line one and in line two, i need to compact the database.


Code: Select all

C:\Program Files (x86)\Microsoft Office\Office15\MSACCESS.EXE "Q:\Temp 8 Days Only\SAPDTW\eric_copy_dtw.mdb"/compact


is my current code for the compacting of the database, but it does not seem to work.

any ideas?

Compo
Posts: 600
Joined: 21 Mar 2014 08:50

Re: compact an access database from a batch file

#2 Post by Compo » 11 Jul 2016 10:50

Make sure you enclose paths containing spaces inside doublequotes
"C:\Program Files (x86)\Microsoft Office\Office15\MSACCESS.EXE"

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: compact an access database from a batch file

#3 Post by foxidrive » 11 Jul 2016 11:55

Powabunga_ wrote:

Code: Select all

C:\Program Files (x86)\Microsoft Office\Office15\MSACCESS.EXE "Q:\Temp 8 Days Only\SAPDTW\eric_copy_dtw.mdb"/compact


is my current code for the compacting of the database, but it does not seem to work.


It is always valuable information for readers to know how it seemed to fail.
1) Was there no change in the file?
2) Was there an error message? If so then show the error message.

This is essential information in many cases and removes the need for waiting for extra information - in a question and then your next reply.

Compo's given you the answer and I'll just comment that the /compact switch should have a space before the slash as a good practice in writing code. Some commands will work without a space there, but others will just give you an error.

Post Reply