If recordsource search has no match

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Chris Philpott

    If recordsource search has no match

    I search my form using the RecordSource which works really well until there's no match for the criteria (created between cboSearchField and txtSearchString ). If there's no match I get a completely blank form (fields & labels... everything is gone). I want to add an IF statement if there are no matches to bring up a message box to search for something else but I cant find out how to write the arguement? Any help would be appreciated.


    Code:
     GCriteria = cboSearchField.Value & " LIKE '*" & txtSearchString & "*'"
            
            Form_frmResults.RecordSource = "select * from qryContractVendors where " & GCriteria
            
            DoCmd.Close acForm, "frmSearch"
            
            MsgBox "Results have been filtered on the criteria you selected."
Working...