Get pass a password-Excel to Access

I this code in excel, How do I get pass the "password".

At this point, click the command button and it open Access and bypass the password and go directly to a form.

'opens access
   
    Range("Q23").Select
   
   
    ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="Volume.mdb", _
        TextToDisplay:="Volume.mdb"
   
    Range("Q23").Select
   
    Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
    Set App = GetObject("\\Dtcnas-ilsp002\mandatory\Analysts - Working Files\Carol\Demo\Volume.mdb;pwd=OPPs;")
App.Application.DoCmd.RunMacro "Macro2CloseSwitchboard"
App.Application.DoCmd.openform "Form"


 Any help would greatly be appreciated!



ca1358Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Generally you must pass the db password via  commandline switch. Perhaps this code snippet will help (came from here:  http://support.microsoft.com/?id=147816#E0GE0ADAAA)

This uses ULS, but you can alter the commandline switches to insert the db password. You may not need the /user switch either, so you may need to comment out that line.

   Option Explicit
   Dim objAccess as Object

   '----------------------------------------------------------------------
   'This procedure sets a module-level variable, objAccess, to refer to
   'an instance of Microsoft Access. The code first tries to use GetObject
   'to refer to an instance that might already be open. If an instance is
   'not already open, the Shell() function opens a new instance and
   'specifies the user and password, based on the arguments passed to the
   'procedure.
   '
   'Calling example: OpenSecured varUser:="Admin", varPw:=""
   '----------------------------------------------------------------------

   Sub OpenSecured(Optional varUser As Variant, Optional varPw As Variant)
      Dim cmd As String
      On Error Resume Next
      Set objAccess = GetObject(, "Access.Application")
      If Err <> 0 Then 'no instance of Access is open
        If IsMissing(varUser) Then varUser = "Admin"
        cmd = "C:\Program Files\Microsoft Office\Office\MSAccess.exe"
        cmd = cmd & " /nostartup /user " & varUser
        If Not IsMissing(varPw) Then cmd = cmd & " /pwd " & varPw
        Shell pathname:=cmd, windowstyle:=6
        Do 'Wait for shelled process to finish.
          Err = 0
          Set objAccess = GetObject(, "Access.Application")
        Loop While Err <> 0
      End If
   End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JackOfPHCommented:
listen
0
ca1358Author Commented:
still trying to figure this out!!
0
ca1358Author Commented:
Got this work, thank you all for your help!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.