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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a Search (Query) Page

Status
Not open for further replies.

RussOSU

Technical User
Apr 16, 2001
93
US
I am creating a database to track job requests from a webpage. I would like the users to be able to search for past job requests, by 4 different text boxes. They only have to fill in info in 1 of the 4 boxes. I would like the results from this query/search to the display the titles into a list box below.

Since I am a beginner to the .asp and access 2000 and really all of this webpage design I could use some help on how to do this. I am not very strong in vbs but I can do some, .js I know a little and can figure out what the code is doing but dont' really know how to write a code without a similar code next to me. So any help you can give would be great.

Thanks
Russ
 
Hey Dogg,

use some if then statements to create the SQL statement

strVar1 = request.form("item1")
strVar2 = request.form("item2")
etc. for each box that is possible

strSQL = "select * from my_table where "
if strVar1 <> &quot;&quot; then
strSQL = strSQL & &quot;column1 = '&quot; & strVar1
end if
if strVar2 <> &quot;&quot; then
strSQL = strSQL & &quot;column1 = '&quot; & strVar2
end if
if strVar3 <> &quot;&quot; then
strSQL = strSQL & &quot;column1 = '&quot; & strVar3
end if
if strVar4 <> &quot;&quot; then
strSQL = strSQL & &quot;column1 = '&quot; & strVar4
end if

objRS.open (strSQL)

hope this helps... Bastien

There are many ways to skin this cat,
but it still tastes like chicken
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top