S
Sandy
I am trying to synchronise two combo boxes on a form but get no list in the
second.
Details are:-
tblRepairCategory
RepairCategoryID (Primary Key - Autonumber)
RepairCategory (Text)
tblRepairType
RepairTypeID (Autonumber)
RepairCategoryID (Number - Long)
RepairType (Text)
BuyPrice (Currency)
SellPrice (Currency)
These two tables are linked by RepairCategoryID - One to Many.
My form and combos:-
FormName = DependentCombos
First Combo Box
Name = Categories
RowSourceType = Table/Query
RowSource = tblRepairCategory
ColumnCount = 2
ColumnWidths = 0cm; 2.54cm
BoundColumn = 1
AfterUpdate - Event =
Private Sub Categories_AfterUpdate()
Me.RepairTypes.RowSource = "SELECT RepairType FROM" & _
" tblRepairType WHERE RepairCategoryID = " & Me.Categories &
_
" ORDER BY RepairType"
Me.RepairTypes = Me.RepairTypes.ItemData(0)
End Sub
Second Combo Box
Name = RepairTypes
RowSourceType = Table/Query
ColumnWidths = 5cm
Width = 3cm
I don't fully understand the line
"Me.RepairTypes = Me.RepairTypes.ItemData(0)"
in the 'AfterUpdate. If someone were to explain it that would be good.
Thanks in advance
Sandy
second.
Details are:-
tblRepairCategory
RepairCategoryID (Primary Key - Autonumber)
RepairCategory (Text)
tblRepairType
RepairTypeID (Autonumber)
RepairCategoryID (Number - Long)
RepairType (Text)
BuyPrice (Currency)
SellPrice (Currency)
These two tables are linked by RepairCategoryID - One to Many.
My form and combos:-
FormName = DependentCombos
First Combo Box
Name = Categories
RowSourceType = Table/Query
RowSource = tblRepairCategory
ColumnCount = 2
ColumnWidths = 0cm; 2.54cm
BoundColumn = 1
AfterUpdate - Event =
Private Sub Categories_AfterUpdate()
Me.RepairTypes.RowSource = "SELECT RepairType FROM" & _
" tblRepairType WHERE RepairCategoryID = " & Me.Categories &
_
" ORDER BY RepairType"
Me.RepairTypes = Me.RepairTypes.ItemData(0)
End Sub
Second Combo Box
Name = RepairTypes
RowSourceType = Table/Query
ColumnWidths = 5cm
Width = 3cm
I don't fully understand the line
"Me.RepairTypes = Me.RepairTypes.ItemData(0)"
in the 'AfterUpdate. If someone were to explain it that would be good.
Thanks in advance
Sandy