> Actually, on further consideration, you're going to have a problem if the
user does not select any sort criteria, so you need to include the "ORDER
BY" part in the If Then:
sqlAll= "Select * FROM Sites "
sqlAll= sqlAll & " Where Site_Index > 0 "
If NOT Sort1="" then
sqlAll= sqlAll & " Order By Sort1"
If Not Sort2="" then
sqlAll= sqlAll & ", " & Sort2
Also, if they can select a criteria from the Sort2 field and not Sort1 you
need to validate for that and have them re-do the form or handle it in your
I am working on the logic for any scenario with the 4 pull downs, or, if
they select nothing (which is the easiest to do!) Thanks again.