Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: ANY in search box


Message #1 by gailmac1@h... on Thu, 18 Oct 2001 20:12:10
I have set up a query and it returns correct data when I search for one 

thing (I have a drop down box with options). However, I want the user to 

be able to choose ANY from the drop down box. How do write the SQL 

statement to return ANY records for that particular drop down box? Here is 

my example:



1. I have one drop down box for jobs and a second for locations.

2. The user can choose a specific job and specific location.

3. I want them to also be able to select a specific job and ANY for 

location, or vice versa.



Any help is appreciated.



Thanks,

Gail 
Message #2 by Simon Newton <simonn@h...> on Fri, 19 Oct 2001 06:56:29 +1000
Gail,



 one way i got around this:



 build your SQL statement for the search in stages using if statements to

break it up..



  SQL = "Select * from whatever_table"  



  if request("job_location") <> "any" then

  SQL = SQL + "where [xxxx] = '"& request("job_loc") &"'"

  end if 



and do another if for the job type too..



should work.



Simon.




  Return to Index