J
Jerry Foust via AccessMonster.com
I have a problem with a form that uses a parameter query. I created an If..Then statement to deal with problems of no data found in the parameter query. However, when a user presses cancel on the dialog box of the parameter search box the error "Error 2001: You canceled the previous operation" appears. If I use a do...loop statement to avoid the error I get stuck in an endless loop. The following is a copy of my code (I'm not very knowledgable at writing code).
Private Sub Form_Activate()
On Error GoTo Errorhandler:
If Me.Recordset.RecordCount = 0 Then
Do
MsgBox "No records found. Check spelling and Search again."
Me.Requery
Loop Until Me.Recordset.RecordCount > 0
Errorhandler:
Resume Next
End If
End Sub
Any help would be greatly appreciated.
Jerry
Private Sub Form_Activate()
On Error GoTo Errorhandler:
If Me.Recordset.RecordCount = 0 Then
Do
MsgBox "No records found. Check spelling and Search again."
Me.Requery
Loop Until Me.Recordset.RecordCount > 0
Errorhandler:
Resume Next
End If
End Sub
Any help would be greatly appreciated.
Jerry