I have created a asp form with two dropdown selections boxes. One for Category and the other for manufacturer. These fields are in two different tables in an access database. I have hardcoded the manufacturers and some categories in the form to test it. The for does not seem to work. Can someone give me some help or tell me where to find a script that will help.
<%@LANGUAGE = "VBScript"%>
<% Option Explicit %>
<% Include Virtual=
<BODY BGCOLOR="#FFFFFF">
<%
Dim objRsMFC, objRsCtg, objConn, Dim MfcCount
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRsMFC = Server.CreateObject("ADODB.Recordset") '*** For Manufacturers
Set objRsCtg = Server.CreateObject("ADODB.Recordset") '*** For Categories
objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source = c:\Customer.mdb"
objConn.open '*** Open connnection
'*** Retrieve records from Tables
objRsMFC.Open "Manufacturers", objConn, adOpenDynamic, adLockOptimisstic, adCmdTable
objRsMFC.Open "Categories", objConn, adOpenDynamic, adLockOptimisstic, adCmdTable
%>
<TABLE WIDTH="62%" BORDER="0" BORDERCOLOR="#B1B1B1" CELLSPACING="1" CELLPEDDING="3">
<FORM METHOD="post" ACTION="search2.asp">
<INPUT TYPE="hidden" NAME="posted" VALUE="1">
<TR ALIGN="Right" VALIGN="Middle">
<TD WIDTH=116><FONT SIZE="2" FACE="Georgia, Times New Roman, Times, serif" COLOR="#0066CC">Fast
Find>>> </FONT>
</TD>
<TD WIDTH="5"> </TD>
<TD WIDTH="122" BGCOLOR="#FFFFFF">
<SELECT NAME="pBrand" CLASS='inputboxes'>
<%
<OPTION VALUE="">" All Manufacturers </OPTION> '*** Hope this is not in the table
'*** so i am writing as hardcoded
While Not objRsMfc.EFO '*** Fetch record from database:
'*** Value and mfc are fields where Value=1, 2, 3... and Mfc=Sunbeam ...
Response.Write("<OPTION VALUE=" & <%= objRsMfc("Value") %> & ">" & objRsMfc("Mfc") & "</OPTION>")
objRsMfc.MoveNext
Wend
%>
</SELECT>
</TD>
<TD WIDTH="6"> </TD>
<TD WIDTH="136" BGCOLOR="#FFFFFF">
<SELECT NAME="pSection" CLASS='inputboxes'>
<%
<OPTION VALUE="">" All Categories </OPTION> '*** Hope this is not in the table
'*** so I am writing as hardcoded
While Not objRsCat.EFO '*** Fetch record from database:
'*** Value and Cat are fields where Value= 13, 23, 33... and Cat= Sleeping bags, ...
Response.Write("<OPTION VALUE=" & <%= objRsMfc("Value") %> & ">" & objRsMfc("Cat") & "</OPTION>")
objRsMfc.MoveNext
Wend
objRsMfc.Close
objRsCat.Close
objConn.Close
Set objRsMfc = Nothing
Set objRsCat = Nothing
Set objConn = Nothing
%>
</SELECT>
</TD>
<TD BGCOLOR="#FFFFFF" COLSPAN="3" WIDTH="51">
<TABLE WIDTH="100%" CELLSPACING="0" CELLPADDING="0" BORDER="0">
<TR>
<TD BGCOLOR="#FFFFFF" WIDTH="5%" ALIGN="center">
<INPUT TYPE="submit" VALUE="GO" NAME="submit">
</TD>
</TD>
</TABLE>
</TD>
</FORM>
</TR>
<TABLE>
</BODY>
I don't have PWS isntalled over here. Although the logic is correct, just check out with the syntax error(s) (If any). Hope this helps.