search button works good, here is may question is,i want to create search button where i am just click the button & result show in form or list box or combo box.Where same value is providing many of time different department as different person as usual date was be different.
here is my problem i want to crate when i am searching value in my form than all same record show in form same time.
Here is my code i am using for text search option & it work s fine. please help me find out to solve this problem.
Expand|Select|Wrap|Line Numbers
- Private Sub Command73_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
- DoCmd.ShowAllRecords
- DoCmd.GoToControl ("WalletNumber")
- DoCmd.FindRecord Me!txtSearch
- WalletNumber.SetFocus
- strStudentRef = WalletNumber.Text
- txtSearch.SetFocus
- strSearch = txtSearch.Text
- 'If matching record found sets focus in strStudentID and shows msgbox
- 'and clears search control
- If strStudentRef = strSearch Then
- MsgBox "Match Found For: " & strSearch, , "Congratulations!"
- WalletNumber.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