Click to See Complete Forum and Search --> : Populating combobox vbscript


C19H28O2
March 8th, 2006, 11:42 AM
Hi,

I would like to populate a combo box with certain values depending on another combobox selection, i.e. if someone selects DEBT the combo box will only display the DEBT categories.

I have a table setup like this:

DEBT | ITEM 1
DEBT | ITEM 2
DEBT | ITEM 3
TRANSACTIONS | ITEM 4
TRANSACTIONS | ITEM 5
TRANSACTIONS | ITME 6
.....

The vbscript i have at the moment is this



Set rs = CreateObject("ADODB.Recordset")
sqlSelect = "SELECT * FROM tblCategoriesList WHERE categorie = '" & drpCategories.value & "'"

rs.Open sqlSelect, MSODSC.Connection

while rs.EOF = false
rs.movenext
drpcategorielist.value = rs.fields("Field2")
wend


The above code is on an onchange event which has been generated by Access 2003 Data access page.

Thanks

C19

degsy
March 15th, 2006, 09:08 AM
Here is a basic example of a dependent dropdown
http://computer-helpforum.com/asp/aspfree/dependent_dropdown/ASP_dependent_dropdown_2.asp

See code attached