?
Solved

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

Posted on 2000-04-17
8
Medium Priority
?
1,557 Views
Last Modified: 2008-03-06
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
0
Comment
Question by:G_Thompson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 1

Accepted Solution

by:
Phoat earned 180 total points
ID: 2723156
you could try using different batch files for each instance of access you want to run, then accessing those batch files with one main one.  

Since i dont know anything about NT, that's the only suggestion i could give.  Hope it helps

Phoat
0
 
LVL 10

Expert Comment

by:paasky
ID: 2723232
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
0
 
LVL 10

Expert Comment

by:paasky
ID: 2723241
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
0
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 
LVL 10

Expert Comment

by:paasky
ID: 2723256
(sorry double posting - poor connection combined with impatient expert)
0
 

Author Comment

by:G_Thompson
ID: 2723260
It would be nice to have them all from one batch file but it works, thanks :)
0
 

Author Comment

by:G_Thompson
ID: 2723299
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
0
 

Author Comment

by:G_Thompson
ID: 2723308
The first comments for Phoat the 2nd for Paasky.
0
 
LVL 10

Expert Comment

by:paasky
ID: 2723334
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
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question