Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Specifying < > = in parameterized query

Status
Not open for further replies.

cash0

Programmer
May 23, 2001
22
0
0
AU
I have an access query that I call from ASP with the following where clause:

WHERE level = [CompLevel]

Now, I have a drop down box in which the user can specify 'less than', 'greater than', or 'equal to' a certain value. I want to know how I can pass in < or > or = into the above WHERE clause from ASP.

Any ideas?
 
Check the itemindex of the combobox (I think it's called itemindex). It should be 0,1 or 2 because you have 3 items in your combobox. Create a variable of type string (strSQL) which contains the first part of your query. Then append according to the itemindex value. So:

case itemindex
0: strSQL = strSQL+&quot;>&quot;
1: strSQL = strSQL+&quot;<&quot;
2: strSQL = strSQL+&quot;=&quot;
end

Finally add the rest of your query to this sql string. Make sure your strSQL contains the complete SQL string. Then create a recordset object and fill it with data from that sql string.

That's what I would try. Not sure if it works but it's worth a shot. :)

Bye,
Jeroen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top