SubForm in Tab Control Not Refreshing

B

Bret

I have a form with tab controls.
On first tab is a subform.
The subform populates records based on query with parameter from a combo box
on the same tab. Problem is the subform doesn't refresh after combo box
selection is made. Ive tried numerous combinations of me.setfocus and
Me.refresh and me.requery and repaintobject unsuccessfully, the data does
refreshe successfully after I close the form and re-open form.
I've done my due diligence and searched this board and others and have found
the following as the most common resolution:

Forms!MainFormName!subformName.Form.Requery
Forms!MainFormName!subformName.Requery

The error I constantly receive using the above is:
".....can't find the field 'subformname' referred to in your expression"

Thank you for any assistance.
 
D

Douglas J. Steele

Make sure that the name of the subform control on the parent form
(MainFormName) is actually subformName. Depending on how you added the form
as a subform, the name of the subform control can be different than the name
of the form being used as a subform. It's the control's name you need to
use.
 
J

John W. Vinson

I have a form with tab controls.
On first tab is a subform.
The subform populates records based on query with parameter from a combo box
on the same tab. Problem is the subform doesn't refresh after combo box
selection is made. Ive tried numerous combinations of me.setfocus and
Me.refresh and me.requery and repaintobject unsuccessfully, the data does
refreshe successfully after I close the form and re-open form.
I've done my due diligence and searched this board and others and have found
the following as the most common resolution:

Forms!MainFormName!subformName.Form.Requery
Forms!MainFormName!subformName.Requery

The error I constantly receive using the above is:
".....can't find the field 'subformname' referred to in your expression"

Thank you for any assistance.

For code running on the mainform, you need to use the name of the Subform
Control on the mainform. Note that this will sometimes be the same as the name
of the Form object within that control, but not necessarily!

Try

Me!NameOfSubformControl.Form.Requery

in the AfterUpdate event of the combo box.
 
B

Beetle

A subform is contained within a subform control. The name of the subform
control may or may not be the same as the name of the subform itself.
The following line;

Forms!MainFormName!subformName.Form.Requery

is just a generic expression to illustrate how it is done. You need to replace
"MainFormName" with the actual name of your main form and "subformName"
with the actual name of your subform control. You can also use;

Me.subformName.Form.Requery

to shorten it up a bit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top