Solved

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

Posted on 2000-04-17
8
1,459 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
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

911 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

25 Experts available now in Live!

Get 1:1 Help Now