Requery Subform

L

Lori

I have a main form (no data source) that I use to hold objects for navigation
(QBF fields & buttons, Report form buttons...) On the this form I placed a
subform (PendingCalls) based on query to give show the basics of pending
calls only, on that subform is a button that launches a seperate form
PendingCallDetail.

When I click the Close button on PendingCallDetail, I would like the form to
close and update the subform on the main page. I've been playing with
requery for weeks, trying some of the suggestions but nothing seems to work.
I've tried both macro and code.

How do I refer to the Subform of one form from third form? I keep messages
about control not existing.

Lori
 
K

Klatuu

I would use the Unload event of the detail form. The correct syntax is:

Forms!FormName!SubFormControlName.Form.Requery

Note: SubFormControlName is the name of the subform control on the main
form. It is not the name of the form being used in the subform control.
Access will, be default, name them the same, but IMHO, they should not have
the same name.
 
L

Lori

Dave~

See this is where I keep getting messed up after reveiwing the posts here.
I called the main form: f_Main, the subform f_Pending_sf. Your suggesting
that I change the name (not the source object) to something else like
f_Pending_sf_ctrl. So then the syntax would read...

Forms!f_Main!f_Pending_sf_ctrl.Form.Requery

Just tried it. IT WORKS! THANK YOU!

So.... Yes, I'm one of those ... with another dbase, similar but different
situation.

If I wanted to requery not the whole subform but a combo box for a
particular record, I would replace .Form. with the name of the specific
control?

Forms!f_Main!f_Pending_sf_ctrl.cmb_box_name.Requery

~Lori
 
K

Klatuu

--
Dave Hargis, Microsoft Access MVP


Lori said:
Dave~

See this is where I keep getting messed up after reveiwing the posts here.
I called the main form: f_Main, the subform f_Pending_sf. Your suggesting
that I change the name (not the source object) to something else like
f_Pending_sf_ctrl. So then the syntax would read...

Forms!f_Main!f_Pending_sf_ctrl.Form.Requery

Just tried it. IT WORKS! THANK YOU!

So.... Yes, I'm one of those ... with another dbase, similar but different
situation.

If I wanted to requery not the whole subform but a combo box for a
particular record, I would replace .Form. with the name of the specific
control?

Forms!f_Main!f_Pending_sf_ctrl.cmb_box_name.Requery

No. The Form property of the subform control has to be used anytime you are
referring to anything on the subform.

The subform control is NOT a form. It is a control on you main form, just
like any other control. One of its properties is Source Object. This
property identifies the name of the form to attach as the subform.
Therefore, you have to include the Form property if you are addressing
anything on the form that is the subform.
 

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

Top