Re: Syncronizing Combo Boxes
just a suggestion, build in a hurry to give you an idea:
option Explicit
private Sub Combo1_Change()
'this is regional combo
'Be sure user can only select value here,
'or add code to test for correct values and to avoid
'all the DB stuff for each input char
Dim rs as adodb.Recordset, conn as adodb.connection
'code for your connection...
sql = "select * from salesman where id-region = " & Combo1.Text
'exec the query
set rs = conn.execute(stmSql)
'use recorset to populate the second combo
If rs.EOF = false And rs.bof = false then
Do While rs.EOF = false
Combo2.AddItem rs.fields("SalesmanName").Value
rs.movenext
Loop
else
'if no record, clear the combo2
Combo2.Clear
End If
rs.Close
set rs = nothing
'conn.Close
'set conn = nothing
End Sub
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.