Millkind
asked on
Run Access Macro if DB has password
This one is going to be real simple. I have the following code which works great but prompts the user for the database password. Is there a way to send the password with the database path so it won't prompt the user?
Private Sub RunMacro(ByVal sMacro As String)
Dim oAccess As Object
oAccess = CreateObject("Access.Appli cation")
' Open the database
oAccess.OpenCurrentDatabas e(dbpath)
Try
oAccess.DoCmd.RunMAcro(sMa cro)
oAccess.DoCmd.Maximize()
oAccess.Visible = False
Catch e As Exception
MsgBox("Macro is cancelled or does not exist")
Finally
oAccess = Nothing
End Try
End Sub
Private Sub RunMacro(ByVal sMacro As String)
Dim oAccess As Object
oAccess = CreateObject("Access.Appli
' Open the database
oAccess.OpenCurrentDatabas
Try
oAccess.DoCmd.RunMAcro(sMa
oAccess.DoCmd.Maximize()
oAccess.Visible = False
Catch e As Exception
MsgBox("Macro is cancelled or does not exist")
Finally
oAccess = Nothing
End Try
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.