subform refresh

M

Mary

I'm working with a form that has a subform on a subform. When I select from
the dropdown on the main form, the subform refreshes based on the after
update event of the combo box, but the subform that is on it doesn't refresh.
How can I get it to refresh at the same time?

Thanks,
Mary
 
M

Maurice

Mary,

When linked to the mainform by for eample an id field the subform should
refresh autom. If not linked you could place the following in the afterupdate
of the combo:

me.subform.requery (where subform should be the name of your subform).

hth
 
M

Marshall Barton

Maurice said:
When linked to the mainform by for eample an id field the subform should
refresh autom. If not linked you could place the following in the afterupdate
of the combo:

me.subform.requery (where subform should be the name of your subform).


Maurice,

That should be:

Me.subformcontrol.Form.Requery

where subformcontrol is the name of the subform control that
is displaying the form used as a subform. The subform
control and the form object may or may not have the same
name. The .Form property has been required in the last
several versions of Access.
 
M

Maurice

Marshall,

Thanks for pointing that out to me again. I must be very stuborn to get that
one right. I'll get it tattood on my forehead tomorrow.

Mary.. my apologies for that somewhat almost correct advise (i'll be in the
corner again feeling ashamed)
 
M

Mary

Still having trouble with this.

Subform1 is linked to main form by TG
Subform2 is on Subform1 and linked to it by TF
Main form combo box selects TG and subform1 refreshes, but Subform2 only
refreshses if there is data on Subform1.

I've tried putting the requery statement in different areas, but can't get
it to work.

Mary
 
M

Marshall Barton

Mary said:
Still having trouble with this.

Subform1 is linked to main form by TG
Subform2 is on Subform1 and linked to it by TF
Main form combo box selects TG and subform1 refreshes, but Subform2 only
refreshses if there is data on Subform1.

I've tried putting the requery statement in different areas, but can't get
it to work.


It sounds like subform2 is using a record source query
parameter to link the data. Is there a reason why you can
not use the Link Master/Child properties to link the data
automatically?
 
M

Mary

Marshall Barton said:
It sounds like subform2 is using a record source query
parameter to link the data. Is there a reason why you can
not use the Link Master/Child properties to link the data
automatically?

I did use the Master/Child property to link subform2 to subform1. I was
wondering if it made a difference that subform1 is linked to the main form on
a different field than the subform1 to subform2 link?
 
M

Marshall Barton

Mary said:
I did use the Master/Child property to link subform2 to subform1. I was
wondering if it made a difference that subform1 is linked to the main form on
a different field than the subform1 to subform2 link?


If you are using the Link Master/Child properties, then a
Requery will not change the related records displayed in a
subform.

The LinkChildFields property **must** be the name of a field
in the subform's record source table/query. The
LinkMasterFields property can be either the name of a field
in the parent form's record source or the name of a control.
If it's a control name, the control may be bound, use an
expression or be set by a VBA procedure. So No, there is no
need for a grandparent- parent link to be at all like a
parent - grandchild link.

With all that in mind, what is subform2's link master when
there is no data in subform1?
 

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