I use the following code in a text box to jump to a certain record. The way it is now, if there is no record that matches, then it jumps to the first record in the table.
How can I trap or identify when this code returns no match?
I know it would be easy if it were a combo box (NotInList), but there is just to many records to use a combo.
Thank you for any suggestions.
Private Sub txtDateSearch_AfterUpdate()
On Error GoTo Err_txtDateSearch_AfterUpdate
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[ActivityDate] = #" & Me![txtDateSearch] & "#"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
Exit_txtDateSearch_AfterUpdate:
Exit Sub
Err_txtDateSearch_AfterUpdate:
MsgBox Err.Number & Err.Description
Resume Exit_txtDateSearch_AfterUpdate
End Sub
How can I trap or identify when this code returns no match?
I know it would be easy if it were a combo box (NotInList), but there is just to many records to use a combo.
Thank you for any suggestions.
Private Sub txtDateSearch_AfterUpdate()
On Error GoTo Err_txtDateSearch_AfterUpdate
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[ActivityDate] = #" & Me![txtDateSearch] & "#"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
Exit_txtDateSearch_AfterUpdate:
Exit Sub
Err_txtDateSearch_AfterUpdate:
MsgBox Err.Number & Err.Description
Resume Exit_txtDateSearch_AfterUpdate
End Sub