Requery Combo on Subform

sparklegrrl

Registered User.
Local time
Today, 23:29
Joined
Jul 10, 2003
Messages
124
Hi all!

I have a form with 2 combo boxes for zip codes. I have it so that when you add a new zip it updates the table and re-queries both boxes.

The problem I have is that I have a sub-form with a zip code combo box on it that also needs to be re-queried on update.

I'm having trouble finding the right code and where to put it.

Any help is greatly appreciated.
 
forms!masterform!subform!form!cboBox.requery

use the BUILDER, it will get it correct.
 
forms!masterform!subform!form!cboBox.requery

use the BUILDER, it will get it correct.

Still giving me problems...I'm about to throw this machine. LOL

FgYZsSr63CGq8u519
 
Code:
forms!masterform!subform!form!cboBox.requery

there is a mistake there. Controls and forms are items in a collection. "Form" is a property of the subform container. Need a period.

Code:
forms!masterform!subform.form!cboBox.requery
 
Also in the above, "subform" is the actual name of the subform control not the thing inside the control. Often the same sometimes something like child1.
 
Also one simple trick. You can just requery every time you enter the combo. So instead of telling it to requery, just put in the combo's on enter event to requery. Depending on how much data and how often you do this, it could be an expensive choice. If this is hundreds to thousands of zips no problem 10-100s of thousands it will be slow.
 
Also in the above, "subform" is the actual name of the subform control not the thing inside the control. Often the same sometimes something like child1.

Subform control? You mean the combo box?

I'm actually having this issue in 2 places.

a) I need to requery/update a combo in a subform after adding data to the one on the main form (zip code) and

b) I need a cascading combo box that uses the combo box on the main form to populate the 2nd one on the subform (customer/parts)
 
Subform control? You mean the combo box?
No, I mean the subformControl.
I have is that I have a sub-form with a zip code combo box on it that also needs to be re-queried on update.

We interpreted this to mean you want to requery a combobox on a subform being called from the main form after you update the rowsource on the main form.

If that is the case, then in the main form you would call it like follows

Me!NameOfSubformControl.Form!NameOfComboOnSubForm.requery

There are two different things the subform control and the thing inside the subform. Usually they have the same name by default.

For the cascade you have to requery every time. So put the code in the combobox on enter event. That is the easiest. When you go into the subform and enter the control it then requeries itself. That is easier than calling from the main. However to now reference a combobox on the main form from code in the subform you need to use Parent.
from the sub.
me.Parent.NameofControlOnMainForm
 
No, I mean the subformControl.


We interpreted this to mean you want to requery a combobox on a subform being called from the main form after you update the rowsource on the main form.

If that is the case, then in the main form you would call it like follows

Me!NameOfSubformControl.Form!NameOfComboOnSubForm.requery

There are two different things the subform control and the thing inside the subform. Usually they have the same name by default.

For the cascade you have to requery every time. So put the code in the combobox on enter event. That is the easiest. When you go into the subform and enter the control it then requeries itself. That is easier than calling from the main. However to now reference a combobox on the main form from code in the subform you need to use Parent.
from the sub.
me.Parent.NameofControlOnMainForm

Thank you so much! I will keep playing and see what I can do! Have a great day!
 
If still having trouble you maybe can post a stripped down version of the db.
 

Users who are viewing this thread

Back
Top Bottom