local lcPO_Num, lcDescrip, lcCust_Num, lcSQL, lcAnd lcPO_Num = alltrim(ThisForm.txtPO_Num.Value) lcDescrip = alltrim(ThisForm.txtDescrip.Value) lcCust_Num = alltrim(ThisForm.txtCust_Num.Value) if empty(lcPO_Num + lcDescrip + lcCust_Num) ** invalid return .f. endif lcSQL = "select field_list_here from mytable where " lcAnd = "" if not empty(lcPO_Num) lcSQL = lcSQL + "PO_Num like '%" + lcPO_Num + "%' " lcAnd = "AND " endif if not empty(lcDescrip) lcSQL = lcSQL + lcAnd + "Descrip like '%" + lcDescrip + "%' " lcAnd = "AND " endif if not empty(lcCust_Num) lcSQL = lcSQL + "Cust_Num like '%" + lcCust_Num + "%' " endif lcSQL = lcSQL + "order by PO_Num into cursor crsResults" if used("crsResults") use in crsResults endif &lcSQL