Solved

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

Posted on 2000-04-17
8
1,435 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
  • 4
  • 3
8 Comments
 
LVL 1

Accepted Solution

by:
Phoat earned 60 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
 
LVL 10

Expert Comment

by:paasky
ID: 2723256
(sorry double posting - poor connection combined with impatient expert)
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

759 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now