J
Joker via AccessMonster.com
Hello,
I am using Graham Thorpes search but I can't get it to work. I have it set
on a button but when I click it, it does nothing like a "dead" button. Any
ideas would be greatly appreciated.
'--------------------------------------------------------------
'Graham Thorpe 25-01-02
'--------------------------------------------------------------
Private Sub Command283_Click()
Dim strStudentRef As String
Dim strSearch As String
'Check Combo161 for Null value or Null Entry first.
If IsNull(Me![Combo161]) Or (Me![Combo161]) = "" Then
MsgBox "Please enter a value!", vbOKOnly, "Invalid Search Criterion!"
Me![Combo161].SetFocus
Exit Sub
End If
'---------------------------------------------------------------
'Performs the search using value entered into Combo161
'and evaluates this against values in Invnum
DoCmd.ShowAllRecords
DoCmd.GoToControl ("Invnum")
DoCmd.FindRecord Me!Combo161
Invnum.SetFocus
strStudentRef = Invnum.Text
Combo161.SetFocus
strSearch = Combo161.Text
'If matching record found sets focus in Invnum and shows msgbox
'and clears search control
If strStudentRef = strSearch Then
MsgBox "Match Found For: " & strSearch, , "Congratulations!"
Invnum.SetFocus
Combo161 = ""
'If value not found sets focus back to Combo161 and shows msgbox
Else
MsgBox "Match Not Found For: " & strSearch & " - Please Try Again.
", _
, "Invalid Search Criterion!"
Combo161.SetFocus
End If
End Sub
I am using Graham Thorpes search but I can't get it to work. I have it set
on a button but when I click it, it does nothing like a "dead" button. Any
ideas would be greatly appreciated.
'--------------------------------------------------------------
'Graham Thorpe 25-01-02
'--------------------------------------------------------------
Private Sub Command283_Click()
Dim strStudentRef As String
Dim strSearch As String
'Check Combo161 for Null value or Null Entry first.
If IsNull(Me![Combo161]) Or (Me![Combo161]) = "" Then
MsgBox "Please enter a value!", vbOKOnly, "Invalid Search Criterion!"
Me![Combo161].SetFocus
Exit Sub
End If
'---------------------------------------------------------------
'Performs the search using value entered into Combo161
'and evaluates this against values in Invnum
DoCmd.ShowAllRecords
DoCmd.GoToControl ("Invnum")
DoCmd.FindRecord Me!Combo161
Invnum.SetFocus
strStudentRef = Invnum.Text
Combo161.SetFocus
strSearch = Combo161.Text
'If matching record found sets focus in Invnum and shows msgbox
'and clears search control
If strStudentRef = strSearch Then
MsgBox "Match Found For: " & strSearch, , "Congratulations!"
Invnum.SetFocus
Combo161 = ""
'If value not found sets focus back to Combo161 and shows msgbox
Else
MsgBox "Match Not Found For: " & strSearch & " - Please Try Again.
", _
, "Invalid Search Criterion!"
Combo161.SetFocus
End If
End Sub