Connecting Tech Pros Worldwide Help | Site Map

How do I requery a subform from another subform?

Robert
Guest
 
Posts: n/a
#1: Feb 28 '07
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


Allen Browne
Guest
 
Posts: n/a
#2: Feb 28 '07

re: How do I requery a subform from another subform?


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" <cpq1bcle@verizon.netwrote in message
news:WLeFh.7$KF1.1@newsfe03.lga...
Quote:
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
Robert
Guest
 
Posts: n/a
#3: Mar 1 '07

re: How do I requery a subform from another subform?


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

"Allen Browne" <AllenBrowne@SeeSig.Invalidwrote in message
news:45e583b5$0$11579$5a62ac22@per-qv1-newsreader-01.iinet.net.au...
Quote:
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" <cpq1bcle@verizon.netwrote in message
news:WLeFh.7$KF1.1@newsfe03.lga...
Quote:
>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
>

Allen Browne
Guest
 
Posts: n/a
#4: Mar 1 '07

re: How do I requery a subform from another subform?


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" <cpq1bcle@verizon.netwrote in message
news:o6sFh.272$S21.168@newsfe05.lga...
Quote:
Thanks. When I tried that I got the error "Microsoft Access can't find
the field subform2 referred to in your expression".
>
"Allen Browne" <AllenBrowne@SeeSig.Invalidwrote in message
news:45e583b5$0$11579$5a62ac22@per-qv1-newsreader-01.iinet.net.au...
Quote:
>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" <cpq1bcle@verizon.netwrote in message
>news:WLeFh.7$KF1.1@newsfe03.lga...
Quote:
>>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
Guest
 
Posts: n/a
#5: Mar 1 '07

re: How do I requery a subform from another subform?


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" <AllenBrowne@SeeSig.Invalidwrote in message
news:45e6a96e$0$31066$5a62ac22@per-qv1-newsreader-01.iinet.net.au...
Quote:
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" <cpq1bcle@verizon.netwrote in message
news:o6sFh.272$S21.168@newsfe05.lga...
Quote:
>Thanks. When I tried that I got the error "Microsoft Access can't find
>the field subform2 referred to in your expression".
>>
>"Allen Browne" <AllenBrowne@SeeSig.Invalidwrote in message
>news:45e583b5$0$11579$5a62ac22@per-qv1-newsreader-01.iinet.net.au...
Quote:
>>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" <cpq1bcle@verizon.netwrote in message
>>news:WLeFh.7$KF1.1@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.
>

Closed Thread