Skip to main content
Inspiring
Jul 30, 2008 10:36 AM UTC
Question

Dropdown Menu Search

My search page has four dropdown menus.
If a visitor makes a selection from all four dropdowns, my results page
recordset would be easy, select * from table where fieldname1 = dropdown
value 1 AND fieldname2 = dropdown value2 AND etc....
But what if the visitor only makes a selection from two or three of the
dropdown menus?
How would i write the recordet?
Im using classing ASP, Access 2008 and DW 8

Thanks
Andy


This topic is closed to new replies. Start a new post to keep the conversation going.

2 replies

Inspiring
Aug 4, 2008 3:53 PM UTC
Thanks for the reply Nath

Im using AND in my Select Statement on the results page, please see below.
The results are based on the 2 dropdown values. So for instance if only the
location dropdown is used i get the results based on the location value and
the default value for instrumentID. I only want the results based on
dropdown values that have been selected.
Hope im making some sense.

Thanks Again
Andy


<%
Dim RSResults__MMColParam2
RSResults__MMColParam2 = "0"
If (Request("location") <> "") Then
RSResults__MMColParam2 = Request("location")
End If
%>

<%
Dim RSResults__MMColParam3
RSResults__MMColParam3 = "0"
If (Request("InstrumentID") <> "") Then
RSResults__MMColParam3 = Request("InstrumentID")
End If
%>
<%
Dim RSResults
Dim RSResults_numRows

Set RSResults = Server.CreateObject("ADODB.Recordset")
RSResults.ActiveConnection = MM_calcert_STRING
RSResults.Source = "SELECT DISTINCT Assets.[Asset ID], Assets.Description,
Locations.[Location Name], Locations.Site, [Asset Tests].[Test Date], [Asset
Tests].[Test Instrument Serial No], [Asset Tests].User, [Asset Test
Records].[Test Type], [Asset Test Records].Value, [Asset Test Records].Unit,
[Asset Test Records].[Passed Test] FROM Locations INNER JOIN ((Assets INNER
JOIN [Asset Tests] ON Assets.[Asset Key] = [Asset Tests].[Asset ID]) INNER
JOIN [Asset Test Records] ON [Asset Tests].[Test ID] = [Asset Test
Records].[Test ID]) ON Locations.ID = Assets.Location WHERE
Locations.[Location Name] = '" + Replace(RSResults__MMColParam2, "'", "''")
+ "' AND [Asset Tests].[Test Instrument Serial No] = '" +
Replace(RSResults__MMColParam3, "'", "''") + "' ORDER BY Assets.[Asset ID]
ASC"
RSResults.CursorType = 0
RSResults.CursorLocation = 2
RSResults.LockType = 1
RSResults.Open()

RSResults_numRows = 0
%>


"tradmusic.com" <sales@NOSHPAMtradmusic.com> wrote in message
news:g6sgpm$rus$1@forums.macromedia.com...
> How about providing a blank value for the intial value of each drop down?
> If a user doesn't make a selection from any particular drop down/s, then a
> blank value is passed to your results page and the default for that field
> would be selected (%,1,etc).
>
> That's my understanding of how it works anyway. Might not, neccessarily,
> be correct!
>
> HTH
>
> Regards
> Nath.
>
> "Andy" <andy@work.com> wrote in message
> news:g6pg7g$eia$1@forums.macromedia.com...
>> My search page has four dropdown menus.
>> If a visitor makes a selection from all four dropdowns, my results page
>> recordset would be easy, select * from table where fieldname1 = dropdown
>> value 1 AND fieldname2 = dropdown value2 AND etc....
>> But what if the visitor only makes a selection from two or three of the
>> dropdown menus?
>> How would i write the recordet?
>> Im using classing ASP, Access 2008 and DW 8
>>
>> Thanks
>> Andy
>>
>
>


Translate
Inspiring
Jul 31, 2008 2:04 PM UTC
How about providing a blank value for the intial value of each drop down?
If a user doesn't make a selection from any particular drop down/s, then a
blank value is passed to your results page and the default for that field
would be selected (%,1,etc).

That's my understanding of how it works anyway. Might not, neccessarily, be
correct!

HTH

Regards
Nath.

"Andy" <andy@work.com> wrote in message
news:g6pg7g$eia$1@forums.macromedia.com...
> My search page has four dropdown menus.
> If a visitor makes a selection from all four dropdowns, my results page
> recordset would be easy, select * from table where fieldname1 = dropdown
> value 1 AND fieldname2 = dropdown value2 AND etc....
> But what if the visitor only makes a selection from two or three of the
> dropdown menus?
> How would i write the recordet?
> Im using classing ASP, Access 2008 and DW 8
>
> Thanks
> Andy
>


Translate