pathfinder225
New member
- Local time
- Today, 23:05
- Joined
- Jun 5, 2009
- Messages
- 9
hi all,
i have a small task here that ,when i select an item in the first combo box, that selection limits the choices in the second combo box.
tblItems
ID AUTONUMBER
item_name TEXT
tblProducts
ID AUTONUMBER
pro_name TEXT
item_name NUMBER ( this is look up from above table:1)
combobox1: item_name (values from tblItems)
combobox2: pro_name (values should be fetched from tblProducts depending up on value selected in combobox1)
To achieve this i placed the Following code in AfterUpdate event of combobox1
but the problem here is when i execute this, it is taking Me.Combo1(in Query) as parameter but not Values selected a dialog box appears asking to enter value. Anybody please help me to resolve this any help would be greatly appreciated.Hope i have made my problem clear.
Best Regards,
pathfinder.
i have a small task here that ,when i select an item in the first combo box, that selection limits the choices in the second combo box.
tblItems
ID AUTONUMBER
item_name TEXT
tblProducts
ID AUTONUMBER
pro_name TEXT
item_name NUMBER ( this is look up from above table:1)
combobox1: item_name (values from tblItems)
combobox2: pro_name (values should be fetched from tblProducts depending up on value selected in combobox1)
To achieve this i placed the Following code in AfterUpdate event of combobox1
Code:
Private Sub Combo1_AfterUpdate()
' Update the row source of the combo2 combo box
' when the user makes a selection in the combo1
' combo box.
Me.Combo2.RowSource = "SELECT pro_name FROM" & _
" tblProducts WHERE item_name = " & _
Me.Combo1 & _
" ORDER BY pro_name"
Me.Combo2 = Me.Combo2.ItemData(0)
End Sub
but the problem here is when i execute this, it is taking Me.Combo1(in Query) as parameter but not Values selected a dialog box appears asking to enter value. Anybody please help me to resolve this any help would be greatly appreciated.Hope i have made my problem clear.
Best Regards,
pathfinder.