Hello all!
I receive the following error message in Access 97:
"Run Time Error 2501: The OpenForm action was canceled. You used a method of the DoCmd object to carry out an action in Visual Basic, but then clicked Cancel in a dialog box. For example, you used the Close method to close a changed form, then clicked Cancel in a dialog box that asks if you want to save the changes you made to this form."
I then get the option to debug. When I exercise that option, this line of code is highlighted:
DoCmd.OpenForm "LOUForm", , , "ClaimNo='" & strID & "'", acFormEdit
A bit of background about what is going on here: My search form has a listbox and text box. Typing in a value in the text box attempts to find a matching value (claim number) in the list box. If a value is found, double clicking the list box will open another (editing) form "LOUForm" matching the value in the list box. Clear as mud?
My first question: Did I screw up the syntax above? I didn't cancel anything that I am aware of!!! ,=]
Here is the entire routine for reference. Note that global variables were defined elsewhere and are not an issue in this problem.
Thanks for any and all assistance in advance! <smile>
A.
I receive the following error message in Access 97:
"Run Time Error 2501: The OpenForm action was canceled. You used a method of the DoCmd object to carry out an action in Visual Basic, but then clicked Cancel in a dialog box. For example, you used the Close method to close a changed form, then clicked Cancel in a dialog box that asks if you want to save the changes you made to this form."
I then get the option to debug. When I exercise that option, this line of code is highlighted:
DoCmd.OpenForm "LOUForm", , , "ClaimNo='" & strID & "'", acFormEdit
A bit of background about what is going on here: My search form has a listbox and text box. Typing in a value in the text box attempts to find a matching value (claim number) in the list box. If a value is found, double clicking the list box will open another (editing) form "LOUForm" matching the value in the list box. Clear as mud?
My first question: Did I screw up the syntax above? I didn't cancel anything that I am aware of!!! ,=]
Here is the entire routine for reference. Note that global variables were defined elsewhere and are not an issue in this problem.
Code:
Private Sub btnOK_Click()
'Selects the record to modify
For intCount = 0 To Me.ClaimList.ItemsSelected.Count - 1
intCurrentItem = Me.ClaimList.ItemsSelected(intCount)
strID = Me.ClaimList.Column(2, intCurrentItem)
Next
If txtClaimNo = "" Then 'This procedure kicks you back to the list box
intResponse = MsgBox("You must specify a claim to open!", vbOKOnly, "ERROR!")
ClaimList.SetFocus
Exit Sub
End If
intStatus = 1
DoCmd.OpenForm "LOUForm", , , "ClaimNo='" & strID & "'", acFormEdit
DoCmd.GoToControl "txtClaimNo"
End Sub
Thanks for any and all assistance in advance! <smile>
A.