Tips Forum Logo
Tips Forum Home PageSpacerVisit Microsoft Knowledge BaseMAUG Home PageMAUG Russian Home Page

Как заполнить ComboBox на ASP странице
How to populate ComboBox with data from Access table on ASP page

Applies to: Access 97


The trick is to get the <%...%> and <SCRIPT> tags correct.
Here is a code sample:
======================================================
<%
Dim oConn 'ADODB connection
Dim strSQL
Dim dynReport

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open "myDSN", "myUID", "myPWD"
strSQL = "SELECT field1 from Table1"
Set dynReport = oConn.Execute(strSQL)

%>

<OBJECT ID="ComboBox1" WIDTH=300 HEIGHT=24
CLASSID="CLSID:8BD21D30-EC42-11CE-9E0D-00AA006002F3">
<PARAM NAME="VariousPropertyBits" VALUE="746604571">
<PARAM NAME="DisplayStyle" VALUE="3">
<PARAM NAME="Size" VALUE="7938;635">
<PARAM NAME="MatchEntry" VALUE="1">
<PARAM NAME="ShowDropButtonWhen" VALUE="2">
<PARAM NAME="Value" VALUE="Please Select Value">
<PARAM NAME="FontEffects" VALUE="1073741825">
<PARAM NAME="FontHeight" VALUE="165">
<PARAM NAME="FontCharSet" VALUE="0">
<PARAM NAME="FontPitchAndFamily" VALUE="2">
<PARAM NAME="FontWeight" VALUE="700">
</OBJECT>
<%
Do While Not dynReport.EOF %>
<SCRIPT LANGUAGE="1vbscript">
<!--
ComboBox1.Additem "<%=dynReport("field1")%>"
-->
</SCRIPT>
<%
dynReport.MoveNext
Loop
dynReport.Close
oConn.Close

%>

From  MAUG , Entry Date 13.07.98



Microsoft Access Solutions

Written and designed by
Alex Dybenko
Send us your comments
Last Update: 2007-10-15
Copyright © 1998-2007 by MAUG

Alex & Access