Opening a link through access

  • Thread starter Thread starter Eric
  • Start date Start date
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
 
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
 
Back
Top