G
Guest
I am using a command button on a form to open another form. I do not know why "The OpenForm action was canceled" error appears. Below is the code I'm using to open the form and also the On Open Event code I'm using on the form as it opens. I'm hoping someone can shed some light on the reason I'm getting the error.
Private Sub cmdEditCustomer_Click()
DoCmd.OpenForm "frmFindCorrectCustomer", OpenArgs:="Prospective"
DoCmd.Close acForm, "mnuProspectiveCustomers"
End Sub
The code stops and gives me the error at the first line of code. I put a Stop at the second line so I could find the problem. When the code stops, it shows that OpenArgs = Null. I don't know why. Below is the code I have when the other form is supposed to open.
Private Sub Form_Open()
Select Case OpenArgs
Case "Prospective"
Me.cmdFindCustomer.Caption = "Go To Prospective Customer Record"
Case "Active"
Me.cmdFindCustomer.Caption = "Go To Active Customer Record"
Case "Inactive"
Me.cmdFindCustomer.Caption = "Go To Inactive Customer Record"
Case Else
Me.cmdFindCustomer.Caption = "Go To Customer Record"
End Select
End Sub
I would appreciate any insight into the Runtime error (2501). THANK YOU!
Private Sub cmdEditCustomer_Click()
DoCmd.OpenForm "frmFindCorrectCustomer", OpenArgs:="Prospective"
DoCmd.Close acForm, "mnuProspectiveCustomers"
End Sub
The code stops and gives me the error at the first line of code. I put a Stop at the second line so I could find the problem. When the code stops, it shows that OpenArgs = Null. I don't know why. Below is the code I have when the other form is supposed to open.
Private Sub Form_Open()
Select Case OpenArgs
Case "Prospective"
Me.cmdFindCustomer.Caption = "Go To Prospective Customer Record"
Case "Active"
Me.cmdFindCustomer.Caption = "Go To Active Customer Record"
Case "Inactive"
Me.cmdFindCustomer.Caption = "Go To Inactive Customer Record"
Case Else
Me.cmdFindCustomer.Caption = "Go To Customer Record"
End Select
End Sub
I would appreciate any insight into the Runtime error (2501). THANK YOU!