[thelist] ASP & SQL

Anthony Baratta Anthony at Baratta.com
Thu Sep 12 14:11:01 CDT 2002


At 11:06 AM 9/12/2002, Erik Bennett wrote:
>--
>
>Wait, I know what you're going to say. Use AND. But what happens if someone
>doesn't fill out all of the fields?


aryTargetFields = ('FieldOne','FieldTwo',FieldThree','FieldFour')
strSearch = ""
for each Fld in aryTargetFields
if not CheckNull(FieldOne) then
    if CheckNull(strSearch) then
        strSearch = & " " & Fld & "like '%" & Trim(Request.Form(Fld)) & "%'"
    else
        strSearch = strSearch & "AND FieldOne like '%" & FieldOne & "%'"
    end if
end

if not CheckNull(strSearch) then
    '''Run Search
else
    '''No Search Data
end if

Function CheckNull(varString)
     if not(Trim(varString) = "" or isNull(Trim(varString))) then
                 CheckNull = False
     else
         CheckNull = True
     end if
End Function
--
Anthony Baratta
President
Keyboard Jockeys

"Conformity is the refuge of the unimaginative."




More information about the thelist mailing list