Access 97 command line switches

P

Patrick McGuire

I'm using an Access97 database as a front-end for
launching another Access97 database. I construct a
command string to use Shell(strCmd) where strCmd contains
the location of MSACCESS.exe, the database to launch, the
username and password, and the workgroup. I want to use
the UNC path for the workgroup file, since not all my
users are mapped identically. However, Access97's shell
command doesn't seem to like this. This strategy seems to
work fine with 2000 and 2002. Anybody know how to do what
I want to do in '97?

Thanks,

Pat
 
D

Dev Ashish

However, Access97's shell
command doesn't seem to like this. This strategy seems to
work fine with 2000 and 2002.

It would help if you provided the code you're using. In general, this
could be associated with spaces in folder names. Make sure that you double-
up the quotes around each option before calling Shell.

-- Dev
 
P

Patrick McGuire

As it happens, it appears to be the presence of a dash (-)
in one of the folder names in the path. While the 2000
and XP versions handle the dash without a problem, I
needed to double up the dash to get the 97 version to
accept it.
 
D

Dev Ashish

As it happens, it appears to be the presence of a dash (-)
in one of the folder names in the path. While the 2000
and XP versions handle the dash without a problem, I
needed to double up the dash to get the 97 version to
accept it.

That's strange; while I haven't worked with Access 97 in a while, I'm
pretty sure the only special chars the command line cares for (which you
need to double-up) are '/' and ';'.

-- Dev
 
A

Andy

Here's some I code I use.

hth,
Andy


'---------------------------------------------------------------------------
-------
'sOpenMDB
'
'Purpose:
' This service opens another database.
'
'Parameters:
' strInMDB - Database to tbe opened
'
'Notes:
'
'
'Rev Num Date Author Description of Change
'------- -------- ------ ----------------------------------------------
-------
' 002 05/10/00 ash Use Shell vs SendKeys
' Clear the /CMD parameter
' 001 03/01/99 ash Code Courtesy of Dev Ashish
'---------------------------------------------------------------------------
-------
Public Sub sOpenMDB _
(strMdbPath As String, _
Optional Secured As Boolean = False, _
Optional strMdwPath As String)

On Error GoTo Err_sOpenDataBase

Dim rst As Recordset
Dim strAccess As String
Dim strCmd As String
Dim User As String

Const QS = """"

User = "Admin"

strAccess = SysCmd(acSysCmdAccessDir) & "MSACCESS.EXE"

strCmd = QS & strAccess & QS & " "

If User <> "Admin" Then
strCmd = strCmd & " /user " & QS & User & QS & " "
End If

If File_Exists(strMdwPath) Then
strCmd = strCmd & " /wrkgrp " & QS & strMdwPath & QS & " "
End If

strCmd = strCmd & QS & strMdbPath & QS & " /cmd "

Shell strCmd, vbNormalFocus

Application.Quit

Err_sOpenDataBase:
MsgBox Err.Description

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top