One alternative to this would be to only include the where clause if there is something in field.
SQL = "Select * from mytable where 1=1 "
if len(textfield) > 0 then SQL = SQL & " and dbFieldvalue = '" & textfield & "'"
if len(textfield2) > 0 then SQL = SQL & " and dbFieldvalue2 = '" & textfield2 & "'"
Another alternative is to use the LIKE statement.
This is quite common with search fields because it allows the user to put in part of the text being searched for.
SQL = "Select * from mytable where"
SQL = SQL & " dbFieldvalue LIKE '%" & textfield & "%'"
SQL = SQL & " and dbFieldvalue2 LIKE '%" & textfield2 & "%'"
The advangage of the second method is that you can enter part of the text and still return a result. So if you are seaching for 'john', records containing 'john' would be returned as well as records containing 'johnson'.
So if the textfield was empty it would return all rows.
The disadvantage is that it is a slower query.
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.