I have a table named : schoolInfo in access 2007! and it has two fields ( schName and mjrName) Now I'm trying to design a combo in visual basic 6 (cboMajors) which is related to the other combo (cboSchool) as a matter of fact I wanna have to cascading combo boxes! when I choose an Item in cboSchool the other combo should represents just the related majors for that school ( records with schName=x and mjrName=y)
Now: the first combo gets correct values but the second one is completely Empty! could anybody help me please? thanks in advanced
Private Sub Form_Activate()
connection ' the Connection is a code in module contains codes are needed to make the connection between form and the database
fill_schools fill_majors
End Sub
Private Sub fill_schools() With rs
.Open "select DISTINCT schName from tblSchoolsInfo", cn, 2, 3
Do While Not .EOF
cboSchool.AddItem (.Fields(0))
.MoveNext
Loop
End With rs.Close End Sub
Private Sub fill_majors()
With rs .Open "select DISTINCT mjrName from tblSchoolsInfo where schName= '" & Me.cboSchool & " '", cn, 2, 3
Do While Not .EOF
cboMajors.AddItem (.Fields(0))
.MoveNext
Loop
End With
End Sub
Now: the first combo gets correct values but the second one is completely Empty! could anybody help me please? thanks in advanced