how do i make 2 dependent combo boxes in Access?

R

Rob

Hello, I am trying to make a form with 3 combo boxes. Each relies on the
other so that combobox1 forces combobox2 to have certain entries and then
combobox 2 forces combox3 to have certain entries. I put this in the after
update code:

Private Sub LeadID2_AfterUpdate()
Dim strSQL As String
strSQL = "Select DivID2, Division"
strSQL = strSQL & " from RegulatoryDivisionTbl"
strSQL = strSQL & " Where RegulatoryBody ='" & Me!LeadID2 & "';"
Me!DivID2.RowSourceType = "Table/Query"
Me!DivID2.RowSource = strSQL

End Sub

Private Sub DivID2_AfterUpdate()
Dim str2SQL As String
str2SQL = "Select Location"
str2SQL = str2SQL & " from DivisionLocationTbl"
str2SQL = str2SQL & " Where Division ='" & Me!DivID2 & "';"
Me!Location.RowSourceType = "Table/Query"
Me!Location.RowSource = str2SQL

End Sub


See this works beautifully, EXCEPT, when I make a new entry the entries
prior lose the information in the second combo box (first coding). Any
suggestions? What am I doing wrong? I also tried this with just using a
query in the row select field and both boxes would go blank after adding a
new entry.

Thank You for any help.

PS If you need more information, just ask.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top