Using Shell to open an access database and its associated workgroup file

  • Thread starter Thread starter John Baker
  • Start date Start date
J

John Baker

I would like to open an Access database from another access database form
and set the workgroup file for the new database.
I have tried to open a shortcut file from the code of the form but not sure
how to do it correctly.

I have also tried using the shell command and the command line equivalent to
opening the databse with the correct workgroup. It seems to work OK except
when there are spaces in the path name folders or in the database file name.

Can any one help me with the syntax to account for spaces?
The code I used successfully is below. I aslo will need to replace the
actual pathnames and file names with variables to make the code generic for
whichever database file is chossen to be open. Again the names may include
spaces.

Dim RetVal
Const q As String * 1 = """"

varSitewide = "C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE" & "
" & "C:\BMS\SiteWide\SiteWideLog.mdb" & " " & "/wrkgrp" & q &
"H:\BMS\Databases\MSAccessWorkgroups\SYSTEMaaa.MDW"

RetVal = Shell(varSitewide, 1)

Any help greatly appreciated
John B
 
Hi John,

Put a breakpoint in the code on the "Retval =" line, then when it stops
at that point examine the value of varSitewide.

You'll need to add more quotes as you build varSitewide to get it right.
Maybe
varSitewide = q & "C:\...msaccess.exe" & q & " " _
& q & "C:\...log.mdb" & q _
& " /wrkgrp " & q & "H:\....MDW" & q
 
Back
Top