I am trying to create a switchboard button in Access 2007 that will open a password input box as a security for a form. The switchboard button calls a macro which will then invoke a macro to run the following code:
Public Function Password() Dim stDocName As String Dim stLinkCriteria As String Dim strUserID As String Dim strPassword As String Dim strPrompt1 Dim strPrompt2 Dim strTitle1 Dim strTitle2 strPrompt1 = "Enter Password" strTitle1 = "Password" strPassword = InputBox(strPrompt1, strTitle1) If strPassword = "update" Then stDocName = "Issue Log" DoCmd.OpenForm stDocName, , , stLinkCriteria Else MsgBox "Your are not Authorised to access this" End If 'Application.Quit End Function
The code works when I run the macro, I get this error message:
"The expression you entered has a function name that Microsoft Office Access can't find."
and returns and Action Faile with Error Number 2950.
If I click the switchboard button, I get this error message:
"The object doesn't contain the Automation object 'Password.'"
Can someone please point me in the right direction?