R
Russ Mills
Hi all,
It has taken me awhile, but I finally have cascading combo boxes working
(see http://joeaccess.home.insightbb.com/cascading_combos.zip). Now my
problem is:
(1) the values chosen in the combo boxes do not get stored in the table I
have associated them with. I think this is because both combo boxes are
unbound, but I don't know how to fix it.
(2) when I change records in the form the combo boxes are not updated.
Here's the set up:
[Table-CompanyNames] is a table containing only the CompanyID and
CompanyName.
[Table-Customers] is a table containing customer info, including the
CustomerID, and CompanyID/CompanyName from the [Table-CompanyNames] table.
[Table-ProjectInfo] is a table containing CompanyName, Customer info, and
additional project info.
In the form, the first combo box is the CompanyName. The second combo box
is the CustomerName, which is dependent on the CompanyName. (Only the
customers that work for ACME will be listed when company ACME is chosen.)
The combo boxes work like a charm but they do not change the
[Table-ProjectInfo] table.
Relations are as follows:
[Table-CompanyNames] related to [Table-Customers] as 1-to-many.
[Table-Customers] related to [Table-ProjectInfo].
Coding for the combo boxes:
Private Sub CompanyName_Combo_AfterUpdate()
Me.ContactName_Combo.RowSource = "SELECT ContactName FROM" & _
" [Table-Customers] WHERE CompanyID = " & Me.CompanyName_Combo & _
" ORDER BY ContactName"
Me.ContactName_Combo = Me.ContactName_Combo.ItemData(0)
End Sub
Finally, if you've gotten this far and you still want to help, I've placed
the sample database at:
http://JoeAccess.home.insightbb.com/index.htm
It has taken me awhile, but I finally have cascading combo boxes working
(see http://joeaccess.home.insightbb.com/cascading_combos.zip). Now my
problem is:
(1) the values chosen in the combo boxes do not get stored in the table I
have associated them with. I think this is because both combo boxes are
unbound, but I don't know how to fix it.
(2) when I change records in the form the combo boxes are not updated.
Here's the set up:
[Table-CompanyNames] is a table containing only the CompanyID and
CompanyName.
[Table-Customers] is a table containing customer info, including the
CustomerID, and CompanyID/CompanyName from the [Table-CompanyNames] table.
[Table-ProjectInfo] is a table containing CompanyName, Customer info, and
additional project info.
In the form, the first combo box is the CompanyName. The second combo box
is the CustomerName, which is dependent on the CompanyName. (Only the
customers that work for ACME will be listed when company ACME is chosen.)
The combo boxes work like a charm but they do not change the
[Table-ProjectInfo] table.
Relations are as follows:
[Table-CompanyNames] related to [Table-Customers] as 1-to-many.
[Table-Customers] related to [Table-ProjectInfo].
Coding for the combo boxes:
Private Sub CompanyName_Combo_AfterUpdate()
Me.ContactName_Combo.RowSource = "SELECT ContactName FROM" & _
" [Table-Customers] WHERE CompanyID = " & Me.CompanyName_Combo & _
" ORDER BY ContactName"
Me.ContactName_Combo = Me.ContactName_Combo.ItemData(0)
End Sub
Finally, if you've gotten this far and you still want to help, I've placed
the sample database at:
http://JoeAccess.home.insightbb.com/index.htm