Previous Thread

7/5/2006 6:31:31 AM    Re: Using Shell to open an access database and its associated workgroup file
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 
 
On Wed, 5 Jul 2006 11:00:00 +1000, "John Baker" <johnbaker@invalid.com> 
 
wrote: 
 
-- 
 
John Nurick [Microsoft Access MVP] 
 
Please respond in the newgroup and not by email.



7/5/2006 11:00:00 AM    Using Shell to open an access database and its associated workgroup file
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