Private Sub cmdSearch_Click()
Dim rst As DAO.Recordset
'Check txtSearch for Null value or Nill Entry first.
If IsNull(Me![txtSearch]) Or (Me![txtSearch]) = "" Then
MsgBox "Please enter a value!", vbOKOnly, "Invalid Search Criterion!"
Me![txtSearch].SetFocus
Exit Sub
End If
'---------------------------------------------------------------
'Performs the search using value entered into txtSearch
'and evaluates this against values in strStudentID
Set rst = Me.RecordsetClone
rst.FindFirst "strStudentID LIKE '*" & Me.txtSearch & "*'"
If Not rst.NoMatch Then
MsgBox "Match Found For: " & strSearch, , "Congratulations!"
Me.Bookmark = rst.Bookmark
Else
MsgBox "Match Not Found For: " & strSearch & " - Please Try Again.", , "Invalid Search Criterion!"
End If
End Sub
|