Solved Combobox in a child form (1 Viewer)

silversun

Registered User.
Local time
Yesterday, 23:40
Joined
Dec 28, 2012
Messages
204
I didn't look at the database so I'm not sure what that means. If it means you want to see the quantity when the units is not Each (or whatever you use), you would change the RowSource query of the combo to concatenate the two fields.
The cmc_units must only show the units we use for voluumes (when water is selected in cmb_items) rather than the mass units.
In that version (the one that mike60smart posted) it would show the mass units for any selection in cmb_items.
My issue was fixed with the solution from June7 and now it is working.
I am going to mark this thread as Solved once mike60smart responded to the last post.
Thank you all for the help.
Masoud
 

June7

AWF VIP
Local time
Yesterday, 22:40
Joined
Mar 9, 2014
Messages
5,470
cmb_units filters for unit_tier = 1. If you want this combobox list to be conditional on item_id, then need to change the RowSource to reference cmb_items for criteria and code to Requery cmb_units.

SELECT T_units.[unit_ID], T_units.[unit], T_units.[unit_tier] FROM T_units WHERE t_units.unit_tier = [cmb_items].Column(2);

Private Sub cmb_units_GotFocus()
Me.cmb_units.Requery
End Sub

Cascading/Conditional combobox is a common topic. Review https://stackoverflow.com/questions...ous-form-the-second-combo-doesnt-show-its-val

For some reason your form is not cooperating with the Requery command. So instead:

SELECT T_units.[unit_ID], T_units.[unit], T_units.[unit_tier] FROM T_units;

Private Sub cmb_units_GotFocus()
Me.cmb_units.RowSource = "SELECT [unit_ID], [unit], [unit_tier] FROM T_units WHERE unit_tier = " & Me.cmb_items.Column(2) & "; "
End Sub
 
Last edited:

silversun

Registered User.
Local time
Yesterday, 23:40
Joined
Dec 28, 2012
Messages
204
cmb_units filters for unit_tier = 1. If you want this combobox list to be conditional on item_id, then need to change the RowSource to reference cmb_items for criteria and code to Requery cmb_units.

SELECT T_units.[unit_ID], T_units.[unit], T_units.[unit_tier] FROM T_units WHERE t_units.unit_tier = [cmb_items].Column(2);

Private Sub cmb_units_GotFocus()
Me.cmb_units.Requery
End Sub

Cascading/Conditional combobox is a common topic. Review https://stackoverflow.com/questions...ous-form-the-second-combo-doesnt-show-its-val

For some reason your form is not cooperating with the Requery command. So instead:

SELECT T_units.[unit_ID], T_units.[unit], T_units.[unit_tier] FROM T_units;

Private Sub cmb_units_GotFocus()
Me.cmb_units.RowSource = "SELECT [unit_ID], [unit], [unit_tier] FROM T_units WHERE unit_tier = " & Me.cmb_items.Column(2) & "; "
End Sub
Thank you so much for your help.
I will use your solution to fix the issue and learn more about it.
 

Users who are viewing this thread

Top Bottom