Hello,
I have a question about getting results sorted. Here is my code:
Private Sub cmdSearch_Click()
If Len(cboSearchField) = 0 Or IsNull(cboSearchField) = True Then
MsgBox "You must select a field to search."
ElseIf Len(txtSearchString) = 0 Or IsNull(txtSearchString) = True Then
MsgBox "You must enter a search string."
'If Searching by Member # - from separate form/table
ElseIf Me.cboSearchField.Value = "Member_Number" Then
'Generate search criteria
GCriteria = cboSearchField.Value & " Like '*" & txtSearchString & "*'"
'Send records that match criteria to listbox
Form_SCITSearch.cmbSearchResults.RowSource = "select * from Members where " & GCriteria
'Force SearchResults combo box to drop down
DoCmd.GoToControl "cmbSearchResults"
SendKeys "%{Down}"
Else
'Generate search criteria
GCriteria = cboSearchField.Value & " LIKE '*" & txtSearchString & "*'"
'SORT RECORDS RETURNED TO ALPHABETICAL BASED ON LAST NAME OF RECORD
???????
'Send records that match criteria to listbox
Form_SCITSearch.cmbSearchResults.RowSource = "select * from Files where " & GCriteria
'Force SearchResults combo box to drop down
DoCmd.GoToControl "cmbSearchResults"
SendKeys "%{Down}"
End If
End Sub
I hope this makes sense. I put a note in where I think I need to add the code but I'm not sure if that's exactly the place. The first section of code is actually irrelevant at this point. Please let me know of any suggestions you may have.
Thank you!
I have a question about getting results sorted. Here is my code:
Private Sub cmdSearch_Click()
If Len(cboSearchField) = 0 Or IsNull(cboSearchField) = True Then
MsgBox "You must select a field to search."
ElseIf Len(txtSearchString) = 0 Or IsNull(txtSearchString) = True Then
MsgBox "You must enter a search string."
'If Searching by Member # - from separate form/table
ElseIf Me.cboSearchField.Value = "Member_Number" Then
'Generate search criteria
GCriteria = cboSearchField.Value & " Like '*" & txtSearchString & "*'"
'Send records that match criteria to listbox
Form_SCITSearch.cmbSearchResults.RowSource = "select * from Members where " & GCriteria
'Force SearchResults combo box to drop down
DoCmd.GoToControl "cmbSearchResults"
SendKeys "%{Down}"
Else
'Generate search criteria
GCriteria = cboSearchField.Value & " LIKE '*" & txtSearchString & "*'"
'SORT RECORDS RETURNED TO ALPHABETICAL BASED ON LAST NAME OF RECORD
???????
'Send records that match criteria to listbox
Form_SCITSearch.cmbSearchResults.RowSource = "select * from Files where " & GCriteria
'Force SearchResults combo box to drop down
DoCmd.GoToControl "cmbSearchResults"
SendKeys "%{Down}"
End If
End Sub
I hope this makes sense. I put a note in where I think I need to add the code but I'm not sure if that's exactly the place. The first section of code is actually irrelevant at this point. Please let me know of any suggestions you may have.
Thank you!