I have 3 boxes/fields in a search form. I can perform a search by filling out 1 field, 2 fields or all 3 of them.
The fields are
1 combo box (I can select a country, say Canada and get the search filtering all Canadian records)
2 text boxes (I can type in a keyword to get the search boxes brings in results too)
Now if I don't type/choose in anything at all from these 3 fields, my program kinda crashes/goes in to debug.
What I want is few lines of code to check if anything is entered (using AND) and if not I want a message displayed saying something like "you must have at least 1 criteria to search"
And then stop there.
what I have so far is this but I think I am wrong here considering I did little VB coding way back.
If IsNull(txtSearchField1) AND isNull(txtSearchField2) AND IsNull(cboSearchField1) Then
MsgBox "you must have at least 1 criteria to search"
<<I believe my rest of the search code goes here?>>
Thanks for the help!