By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,510 Members | 1,430 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,510 IT Pros & Developers. It's quick & easy.

How do I requery a subform from another subform?

P: n/a
Hello. I have a form with 2 subforms on it, subform1 and subform2. Is
there some way to requery subform2 from an after update event on one of the
fields on subform1? What would the syntax of that be?
Me.Form.Subform.subform2.requery does not seem to work.

Robert
Feb 28 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
If the main form has 2 subforms on it, and you want to requery #2 from #1,
try:
Me.Parent![subform2].Form.Requery

Note that it is possible to trigger an endless loop with this kind of thing,
e.g. if there is any dependency between the 2 subforms, if LinkMasterFields
depends on a calculated control, or if you have conditional formatting.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Robert" <cp******@verizon.netwrote in message
news:WL***********@newsfe03.lga...
Hello. I have a form with 2 subforms on it, subform1 and subform2. Is
there some way to requery subform2 from an after update event on one of
the
fields on subform1? What would the syntax of that be?
Me.Form.Subform.subform2.requery does not seem to work.

Robert
Feb 28 '07 #2

P: n/a
Thanks. When I tried that I got the error "Microsoft Access can't find the
field subform2 referred to in your expression".

"Allen Browne" <Al*********@SeeSig.Invalidwrote in message
news:45***********************@per-qv1-newsreader-01.iinet.net.au...
If the main form has 2 subforms on it, and you want to requery #2 from #1,
try:
Me.Parent![subform2].Form.Requery

Note that it is possible to trigger an endless loop with this kind of
thing, e.g. if there is any dependency between the 2 subforms, if
LinkMasterFields depends on a calculated control, or if you have
conditional formatting.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Robert" <cp******@verizon.netwrote in message
news:WL***********@newsfe03.lga...
>Hello. I have a form with 2 subforms on it, subform1 and subform2. Is
there some way to requery subform2 from an after update event on one of
the
fields on subform1? What would the syntax of that be?
Me.Form.Subform.subform2.requery does not seem to work.

Robert

Mar 1 '07 #3

P: n/a
In that case, the subform control may have a different name than the name of
the form that gets loaded into it.

Open the main report in design view.
Right-click the edge of the subform control, and choose Properties.
What is the Name of the control (on the Other tab)?

You need to use that name, not whatever is in the SourceObject property
(which is the name of the form to load into it.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Robert" <cp******@verizon.netwrote in message
news:o6***************@newsfe05.lga...
Thanks. When I tried that I got the error "Microsoft Access can't find
the field subform2 referred to in your expression".

"Allen Browne" <Al*********@SeeSig.Invalidwrote in message
news:45***********************@per-qv1-newsreader-01.iinet.net.au...
>If the main form has 2 subforms on it, and you want to requery #2 from
#1, try:
Me.Parent![subform2].Form.Requery

Note that it is possible to trigger an endless loop with this kind of
thing, e.g. if there is any dependency between the 2 subforms, if
LinkMasterFields depends on a calculated control, or if you have
conditional formatting.

"Robert" <cp******@verizon.netwrote in message
news:WL***********@newsfe03.lga...
>>Hello. I have a form with 2 subforms on it, subform1 and subform2. Is
there some way to requery subform2 from an after update event on one of
the
fields on subform1? What would the syntax of that be?
Me.Form.Subform.subform2.requery does not seem to work.
Mar 1 '07 #4

P: n/a
Bingo! When I removed the blank from the name of the subform I didn't do it
in the main form. Thanks for catching that.

"Allen Browne" <Al*********@SeeSig.Invalidwrote in message
news:45***********************@per-qv1-newsreader-01.iinet.net.au...
In that case, the subform control may have a different name than the name
of the form that gets loaded into it.

Open the main report in design view.
Right-click the edge of the subform control, and choose Properties.
What is the Name of the control (on the Other tab)?

You need to use that name, not whatever is in the SourceObject property
(which is the name of the form to load into it.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Robert" <cp******@verizon.netwrote in message
news:o6***************@newsfe05.lga...
>Thanks. When I tried that I got the error "Microsoft Access can't find
the field subform2 referred to in your expression".

"Allen Browne" <Al*********@SeeSig.Invalidwrote in message
news:45***********************@per-qv1-newsreader-01.iinet.net.au...
>>If the main form has 2 subforms on it, and you want to requery #2 from
#1, try:
Me.Parent![subform2].Form.Requery

Note that it is possible to trigger an endless loop with this kind of
thing, e.g. if there is any dependency between the 2 subforms, if
LinkMasterFields depends on a calculated control, or if you have
conditional formatting.

"Robert" <cp******@verizon.netwrote in message
news:WL***********@newsfe03.lga...
Hello. I have a form with 2 subforms on it, subform1 and subform2. Is
there some way to requery subform2 from an after update event on one of
the
fields on subform1? What would the syntax of that be?
Me.Form.Subform.subform2.requery does not seem to work.

Mar 1 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.