No of visitors who read this post: 414
Category: Visual basic
Type: Question
Author: Patty white
No votes yet

I have encountered this error while trying to use MS Visual Basic program. The following programming codes below are the codes that I am dealing with to fully continue to access it. Please provide some guides on how to resolve this issue.

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
The issue is the DoCmd line where I get a message
Run-time error '2494':
The action or method requires a Form Name argument

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

#

Try to open form as below

Syntax

<Form Name>.Show

Example

Myfrom.Show 

Try to solve your problem as below

 

Assuming you are going to open Activities_Menu  form

Private Sub Open_Activities_Menu_Click()

If InputBox("Enter password") = "111111" Then

Activities_Menu.Show

Else

MsgBox  "You are not authorized!", vbOKOnly

End  If
End  Sub

I am sure you can solve  your problem using the above code