If I understand you correctly you have a form with 7 fields in it. Like
<input name="Input1"> ... <input name="Input7">
Then you want to build a sql statment that pulls those 7 fields but only if
they are filled out.
I'm guessing also that these fields would go into the Where clause of the
SQL Statement. If so then

SQL = "Select * (or whatever fields you need) from table where "
IF Request.form("Input1") <> "" THEN
        SQL = SQL & "ColumnName1='" & Request.Form("Input1") & "' and "
END IF
IF Request.form("Input2") <> "" THEN
        SQL = SQL & "ColumnName2='" & Request.form("Input2") & "' and "
END IF
and then at the end to get rid of the hanging "and" at the end of the SQL
Statemnt
SQL = LEFT(SQL,LEN(SQL)-5)
I think that will do what you want.

-----Original Message-----
From: Jason Burton [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 03, 2002 2:18 AM
To: ActiveServerPages
Subject: ASP / SQL Query Question


I have a multi form field page,

I'm trying to figure out what the best way of
constructing the search would be. (building the query
string).. Theres about 7 fields, and I'd like to
somehow depending on if forms are empty still pull
results with any other 'filled in' field.

Does anyone have an example of this? or even something
I could go by? I'm really having difficulties with
this... and it's holding my project up that i'm trying
to get done ...

It'd be appreciated.

Thnx

Jason Burton
Hilite Industries (www.hilite-ind.com)
[EMAIL PROTECTED] (send to [EMAIL PROTECTED])

__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

---
You are currently subscribed to activeserverpages as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
%%email.unsub%%




---
You are currently subscribed to activeserverpages as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to