I'm using the code below to search for the RefDate (e.g. order date) using the unbound box FindCCDate
It works, but to find the next record with the date, I have to reenter (from date selection icon) the date in the unbound box.
How to I have it continue to search for the RefDate by just using an Enter key without having to reenter the date and then clear the date in FindCCDate after all the records have been searched?
Code:
Private Sub FindCCDate_AfterUpdate()
If (FindCCDate & vbNullString) = vbNullString Then Exit Sub
Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
rs.FindNext "[RefDate]= #" & Format(FindCCDate, "mm-dd-yyyy") & "#"
If rs.NoMatch Then
MsgBox "Sorry, '" & FindCCDate & "' was not found.", vbOKOnly + vbInformation
Else
Me.Recordset.Bookmark = rs.Bookmark
End If
rs.Close
FindCCDate = Null
End Sub