Syntax Problem

jeff_i

Registered User.
Local time
Today, 02:33
Joined
Jan 24, 2003
Messages
50
Hi I am try to get a call shell statment set up but I can't seem to get it right. Here is what I have attempted:

[/CODE]Private Sub Command0_Click()


Dim CComp As New CComputer
Dim straccessdir As String
Dim fullpath As String
Dim Test As String
Dim DPath As String
Dim Workgroup As String



With CComp

straccessdir = .AccessDir

End With

'This is result I am looking for
'Call Shell("""C:\Program Files\Microsoft Office\Office10\MSACCESS.EXE"" ""C:\DCPFRR\DCPFRRRMA_FE.mde"" /wrkgrp ""\\aagsrv1\dcprma\fe\frrrmasecure.mdw"" /User frruser", 1)

fullpath = straccessdir & "MSACCESS.EXE"

DPath = "C:\DCPFRR\DCPFRRRMA_FE.mde"

Workgroup = "\\aagsrv1\dcprma\fe\frrrmasecure.mdw"

Test = fullpath & "& DPath &" & " /wrkgrp " & Workgroup & " /User frruser"


Call Shell(Test, 1)

End Sub


Any suggestions?

Thanks
 
I see too many quotes. It should look like this...

Call Shell("C:\Program Files\Microsoft Office\Office10\msaccess.exe /wrkgrp X:\YourWorkgroup.mdw X:\YourDB.mdb /user YourUser", vbMaximizedFocus)

Use a message box to see what the string looks like while you are testing.

MsgBox Test

HTH
 
ghudson First thanks for the reply!

As for too many quotes that is what I thought, this is how I came up the number of quotes.

1. Copied the command line from a working batch file which I currently use to launch the database
2. Pasted that into a runapp step of a blank macro
3. I then converted the macro to VB in hopes of getting the syntax correct.

So this part works:
Call Shell("""C:\Program Files\Microsoft Office\Office10\MSACCESS.EXE"" ""C:\DCPFRR\DCPFRRRMA_FE.mde"" /wrkgrp ""\\aagsrv1\dcprma\fe\frrrmasecure.mdw"" /User frruser", 1)

My eventual hope is to convert the different parts into variables so I can use the same method to launch several different databases.

Thanks again for your help!
 

Users who are viewing this thread

Back
Top Bottom