Forums

This topic is locked

Advance search

Posted 23 Apr 2002 20:25:51
1
has voted
23 Apr 2002 20:25:51 scre wdanger posted:
Hi everybuddy,
Here i go,
i have a search page. My database consist of five tables. I know how to search a single table or all the tables.
What i want to know is:
how to have a search page with drop downs so that for each table there is a dropdown value and when a particular table from a drop down is choosen it only searches that table.
I hope i formulated my question right.

Replies

Replied 24 Apr 2002 18:19:59
24 Apr 2002 18:19:59 Sean Maher replied:
The best way sounds like doing multiple Recordset Queries, one for each table. Then each drop down would be populated by from each table. So rs1 would return your values from the first table, rs2 from the second and so on. Your Data Bindings palette would have multiple recordsets.

Then each of those fields would be submitted to your search page. Use the Request.Form to get each of those fields and put them into your SQL statement that does the searching.

(8')~
Replied 07 May 2002 02:54:07
07 May 2002 02:54:07 scre wdanger replied:
Thanx bro for the tip
Replied 08 May 2002 11:33:52
08 May 2002 11:33:52 David Behan replied:
Instead of having multiple recordsets... why not set the value section of your drop down menu to the name of the table. Then filter your search on the table selected.

E.G.

rsMax.Source = "SELECT COUNT ([category]) AS MaxCount FROM " & tablestats & " WHERE month = " + Replace(rsMax__MMColParam, "'", "''" + " AND year = " + Replace(rsMax__MMColParam2, "'", "''" + " GROUP BY category ORDER BY Count([category]) DESC"

I used the above script to filter a stats page depending on the table the user specified. They could get the stats for page hits, print page hits, email friend hits, and so on. Each of these where different tables. Instead of building the same pages over and over again I made the link to these pages include a variable called "tabletolookup". What you should take out of this is the
" & tablestats & " section.

Before the above script I specified:

tablestats = request.querystring("tabletolookup"

You can use the same idea but using

tablesearch = request.form("tabletosearch"

This may reduce your work load when writing these scripts for your search.

_________________________
David Behan - www.bmor.com

Reply to this topic