Cascading comboboxes

odrap

Registered User.
Local time
Today, 17:20
Joined
Dec 16, 2008
Messages
156
In a mainform i have a combobox to let the user choose a compagnyname.
Based on this choice , a combobox situated on a subform has to display the articles that can be delivered from this compagny . The combobox on the main form has as dependent column, the LevID which is unique for each compagny. The rowsource of the combobox on the subform is a query into which we have as criterium for the field LevID: Forms!NameOfMainform!LevID .In Order to sync both comboboxes, in the afterupdate event of the combobox in the mainform the value of the combobox o the subform is first put to null and after that a requery is applied on this combobox.
All this seems to have as consequence that also the beforeUpdate of the subform get fired. This brings me into trouble because in this event i check the field Qty in the subform that may not be 0. On that moment i didn't got the time yet to enter a value in the field Qty, and therefore a runtime error occur
1) How does it come that the beforeupdate of the subform get fired?
2)If this is a normal fact, what to do check for a non zero value in the field QTY in the beforeUpdate event of the subform.
 
If the ComboBox on the SubForm is bound to a field in the RecordSource of the SubForm then what you are doing will cause an update of the record in the SubForm. Don't Requery the ComboBox from the MainForm. Do it in the GotFocus or OnEnter event of the ComboBox.
 
Thank you for the help
 
Yes,it helped me out of trouble
Thank you
 

Users who are viewing this thread

Back
Top Bottom