Opening a link through access

E

Eric

Hi,

I have secured a database and designed a link that will
open the database with the appropriate security file. How
can I call/open this link through vba so that the database
will open properly? (I can't just call the database b/c it
won't open if it doesn't see the .mdw file) I am not sure
which command I need to use to accomplish this. Thanks in
advance,

Eric
 
G

Graham Mandeno

Hi Eric

You can construct a string containing the command line exactly as it would
be in the desktop shortcut, and then Shell the command to start Access. For
example:

Dim sCommand as String, lRetVal as Long
Const DQ as String = """" ' double-quote
sCommand = DQ & sPathToMSACCESS & DQ & " "
sCommand = sCommand & DQ & sPathToMDB & DQ
sCommand = sCommand & " /wrkgrp:" & DQ & sPathToMDW & DQ
sCommand = sCommand & " /user:" & sUsername
sCommand = sCommand & " /pwd:" & sPassword
lRetVal = Shell(sCommand, vbMaximizedFocus)
If lRetVal Then AppActivate lRetVal
 

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