|
| |
|
|
Chugachman
Posts: 63 Joined: 2/8/2004 From: Alaska Status: offline
|
4 Search Check Boxes - 3/7/2004 13:51:11
I really tried to do this one on my own but nothing worked. This is the last search form and then I'm done. Jeezum-this is first thing I ever did on a computer that I just couldn't get! Anyway, the last search is for special features on a trail (cabins, glaciers, biking, x-country skiing). In the database they are either Y or N. I want to have a checkbox for each one with the value being Y if checked. So... If I use an AND between them, I will get an error about not having default values if some aren't checked. If I use OR it will not filter for each value (ie: if I choose Cabin and Glacier it won't give me trails that are both but will give me if either). I'm assuming I use the "Where INSTR" but I'm not sure how to write the code when I have 4 different database fields as opposed to the one when I was just doing difficulty.
|
|
|
|
Richard Dudley
Posts: 668 Joined: 8/22/2002 From: Butler, PA Status: offline
|
RE: 4 Search Check Boxes - 3/7/2004 14:55:40
Are you using a stored procedure? If so, there is a slightly better way to do this. At any rate, you can build your SQL statement dynamically. Start with your basic SQL, like: strSQL = "select * from sometable where length=..." Add features conditions dynamically with a series of if...then statements: if request.form("cabins") = true then sql = sql + " and cabins=-1 " end if (use -1 for true if this is an Access DB and the fields are checkboxes--otherwise use whatever value you have in that field) Hope this helps!
_____________________________
I need to change my avatar--the puppy is full grown now!
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|