Link to home
Start Free TrialLog in
Avatar of G_Thompson
G_Thompson

asked on

open a .mdb from a batch file using the Start command

I am trying to start multiple instances of Access from a batch file (different mdbs) so they all run at the same time,
 using the standard:
 [path to Access] [path to mdb] /cmd[stuff as string] eg:"C:\MSAccess.exe" "C:\database.mdb" /cmd "parameters"

repeated for each mdb. works fine in Win95 they all open and operate together but NT waits till the first instance of Access has closed before executing the next command, the way a batch file is suposed to work. SOmeone suggested using the START command (which opens a new dos box then executes the passed command line)eg:

START "C:\Msaccess.exe" "C:\database.mdb" /cmd "parameters"

This opens mutiple instances together but Access igonores the /cmd switch, I think that NT thinks that the /cmd is a Start command switch. Iv'e tried enclosing different bits in "" but no success.

Please help me

G
ASKER CERTIFIED SOLUTION
Avatar of Phoat
Phoat

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hello G_Thompson,

I tried parameter passing with shell() function and it was working fine with my NT workstation. Here's the test code:

Sub SomeTest()
    Dim RetVal As Variant
    Dim instance As Integer
    Dim PathName As String
   
    PathName = Chr(34) & "C:\Program Files\Microsoft Office\Office\msaccess.exe" & Chr(34) & " " & Chr(34) & "c:\temp\x.mdb" & Chr(34) & " /cmd hello world wide web"
   
    For instance = 1 To 3
        RetVal = Shell(PathName, vbNormalNoFocus)
    Next
   
End Sub

Hope this helps,
Paasky
Hello G_Thompson,

I tried parameter passing with shell() function and it was working fine with my NT workstation. Here's the test code:

Sub SomeTest()
    Dim RetVal As Variant
    Dim instance As Integer
    Dim PathName As String
   
    PathName = Chr(34) & "C:\Program Files\Microsoft Office\Office\msaccess.exe" & Chr(34) & " " & Chr(34) & "c:\temp\x.mdb" & Chr(34) & " /cmd hello world wide web"
   
    For instance = 1 To 3
        RetVal = Shell(PathName, vbNormalNoFocus)
    Next
   
End Sub

Hope this helps,
Paasky
(sorry double posting - poor connection combined with impatient expert)
Avatar of G_Thompson
G_Thompson

ASKER

It would be nice to have them all from one batch file but it works, thanks :)
Thanks, but not quite what I'm after.Passky Passing parameters works fine , unless you use the Dos Start command from a batch file(at least as far as I could tell). I want to call several copies at the same time (how on earth do you spell simultainiously? :) calling the mdb's from a batch file NT waits until the first instance of Access (with the first mdb) is closed before it executes the second line, which is supposed to open the second mdb.
Using the Start command in a batch file executes each line one after the other without waiting for the first process to finish(As in Win95) Just what I want but I could not get the Start command to open access with /cmd parameters.

Basicly it's  not a problem with passing /cmd in NT just passing them through the start command. I hope this explains it.

G
The first comments for Phoat the 2nd for Paasky.
G_Thompson, you have some other commands in batch files you wanted also execute and starting Access database with command parameters was not enough?

Some things work differently in Win95/98 and WinNT, batch script running is one of them. Well, that keeps us developers busy testing all applications in all win systems... ;-)

Glad your problem is solved.

Regards,
Paasky