PDA

View Full Version : Can someone please help with problem passing command line arguments



daveinmb
02-16-2007, 04:54 PM
I am usually able to figure things out on my own but I really need some help on this one.

I have have tried numerous times, combinations and spent days and hours now trying to figure this out and I just can't. I am sure it is something stupid like a slash somewhere I have missed.

I have a project that I need to upgrade from AMS 4 to AMS 6 my previous code worked fine in AMS 4 but now I can't get this to work in AMS 6

In AMS 4 I used:

File Execute

With the following:

FileNames C:\Program Files\Microsoft Office\ART\Office\MSACCESS.EXE

Args "C:\Program Files\MY Software\system\ini.mdb" /runtime /WRKGRP "C:\Program Files\MY Software\system\key.mdw" /user My Name /pwd 1234

Working Folder C:\Program Files\MY Software\system\

The only thing I can get to work using Action File.Run in AM6 is:

FileNames "C:\\Program Files\\Microsoft Office\\ART\\Office\\MSACCESS.EXE"

Whenever I add any variation of The command line arguments to pass to the executable such as:

Args "C:\Program Files\MY Software\system\ini.mdb" /runtime /WRKGRP "C:\Program Files\MY Software\system\key.mdw" /user My Name /pwd 1234

Working Folder C:\Program Files\MY Software\system\

I get errors in AMS or errors starting MS Access that it is not a valid MS Access Command.

I have tried \\ and /\ & \/ and you name it and I cant get the argument to pass properly.

Please Help!

bobbie
02-16-2007, 07:01 PM
Just use file.open to open the file and MSACCESS will open the file.
It will give warnings about it but can be open that way.

daveinmb
02-16-2007, 10:04 PM
Thanks but that won't work. The command line arguments are required.

Brett
02-16-2007, 10:21 PM
What is the exact script code that you are using? Please supply it as that will make debugging easier.

mwreyf1
02-17-2007, 02:34 PM
Maybe this will help.


-- TRY THIS

varApp = "C:\\Program Files\\Microsoft Office\\ART\\Office\\MSACCESS.EXE"
varArgs = "\"C:\\Program Files\\MY Software\\system\\ini.mdb\" /runtime /WRKGRP \"C:\\Program Files\\MY Software\\system\\key.mdw\" /user My Name /pwd 1234\""
File.Run(varApp, varArgs, "", SW_SHOWNORMAL, true);

-- OR THIS

varApp = "C:\\Program Files\\Microsoft Office\\ART\\Office\\MSACCESS.EXE"
varArgs = "C:\\Program Files\\MY Software\\system\\ini.mdb\" /runtime /WRKGRP \"C:\\Program Files\\MY Software\\system\\key.mdw\" /user My Name /pwd 1234"
File.Run(varApp, varArgs, "", SW_SHOWNORMAL, true);

daveinmb
02-19-2007, 11:12 AM
Thanks! I am almost there....

I can now get this to work:

"\"C:\\Program Files\\\\MY Software\\system\\ini.mdb\" /runtime /WRKGRP \"C:\\Program Files\\MY Software\\system\\key.mdw\" /user My Name /pwd 1234\""

but it chokes on the Password. MS Access pops up a window with the correct User Name and that the password is invalid. I then type in the same password manually and then it opens the database.

I need this to be transparent so the User does not have to enter the password everytime.

Does anyone else have any sugestions?

Thanks in advance!

daveinmb
02-19-2007, 01:13 PM
Hi Bret!

Here is a stripped down project of what I am trying to do.

It obviously won't work since you do not have ms access runtime installed, but you can see what I am trying to accomplish and hopefully tell me where I am going wrong.

daveinmb
02-19-2007, 01:33 PM
Ok!

I finally got it to work.

Special thanks to mwreyf1 for pointing me in the right direction, Thanks!

This is what I was using:

"\"C:\\Program Files\\\\MY Software\\system\\ini.mdb\" /runtime /WRKGRP \"C:\\Program Files\\MY Software\\system\\key.mdw\" /user My Name /pwd 1234\""

This is what worked:
"\"C:\\Program Files\\\\MY Software\\system\\ini.mdb\" /runtime /WRKGRP \"C:\\Program Files\\MY Software\\system\\key.mdw\" /user My Name /pwd 1234"

The difference so it is easy to see:
"\"C:\\Program Files\\\\MY Software\\system\\ini.mdb\" /runtime /WRKGRP \"C:\\Program Files\\MY Software\\system\\key.mdw\" /user My Name /pwd 1234\""

This should now work for all of the MS Access Commands such as Compact Repair, etc...

Thanks again everyone! :)

mwreyf1
02-20-2007, 01:19 PM
Glad I could be of assistance