DoCmd line Issue: Occurs a Run-time error ‘2494’
I have a problem with my MS Access. I’m trying to use a method of password protecting a command button that I found here. But it doesn’t work properly. The errors are shown below:
If InputBox("password") = "thepassword" then
Docmd.OpenForm formname
Else
MsgBox "You are not authorized!",vbOKOnly
End if
Private Sub Open_Activities_Menu_Click()
If InputBox("Enter password") = "111111" Then
DoCmd.OpenForm Activities_Menu
Else
MsgBox "You are not authorized!", vbOKOnly
End If
End Sub
I think the issue is about the DoCmd line, and here I get a message.
Run-time error '2494':
The action or method requires a Form Name argument
Thanks in advance.








