hi, i have made a search form but still need some help. The form works but is completley case and letter sensitive and would like it to be a little more forgiving. I will paste my code and hopefully someone can help me. thanks!
Code:
Private Sub cmdSearch_Click()
Dim strStudentRef As String
Dim strSearch As String
'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 Address
DoCmd.ShowAllRecords
DoCmd.GoToControl ("Address")
DoCmd.FindRecord Me!txtsearch
Address.SetFocus
strStudentRef = Address.Text
txtsearch.SetFocus
strSearch = txtsearch.Text
'If matching record found sets focus in Address and shows msgbox
'and clears search control
If strStudentRef = strSearch Then
MsgBox "Match Found For: " & strSearch, , "Congratulations!"
Address.SetFocus
txtsearch = ""
'If value not found sets focus back to txtSearch and shows msgbox
Else
MsgBox "Match Not Found For: " & strSearch & " - Please Try Again.", _
, "Invalid Search Criterion!"
txtsearch.SetFocus
End If
End Sub
Comment