Open database on network

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,
I am using the following code to open a database located on another computer
on the network.

Private Sub Command6_Click()
Shell """c:\program files\microsoft office\office11\msaccess.exe"" " &
"""x:\mtds\test.mdb""", vbNormalFocus
DoCmd.Quit
End Sub

Everythig works fine but I have two questions.

1. In order to get the other database to open I have to map the drive. Is
there a way around this? I have tried using the full network path but no luck.

2. Is there a way to open a specific form in the test database without
having to specify the form name in the startup options.

Thanks
 
Hi,
you can use UNC path instead of mapped drive like:
\\MyServer\MyShare\MyFolder\my/mdb

you can also try to use ShellExecute API:
http://maug.pointltd.com/access/Queries/TipDetail.asp?TipID=5

to open specific form - you can either open mdb with /x switch specifying
macro name which will open your form, or you can try to create a shortcut to
your form and use ShellExecute function to open it
 
Alex,
UNC path works fine. Can you give me some detail on the /x switch? I am
uncertain how to apply it.
Thanks
 
Hello,
Well I have tried the /x command all over the place and still can not get it
to work. I would truely appreciate it if someone could tell me how to apply
the /x switch with a macro name of "test" to the code I submitted in my first
post.
Thanks
 
Try to look at Access Help for command line options.
here an extract:
/x macro
Starts Microsoft Access and runs the specified macro. Another way to run a
macro when you open a database is to use an AutoExec macro.
 
Back
Top