Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old February 28th, 2007, 12:55 PM
Robert
Guest
 
Posts: n/a
Default How do I requery a subform from another subform?

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


  #2  
Old February 28th, 2007, 01:45 PM
Allen Browne
Guest
 
Posts: n/a
Default 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
  #3  
Old March 1st, 2007, 04:05 AM
Robert
Guest
 
Posts: n/a
Default 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
>

  #4  
Old March 1st, 2007, 10:35 AM
Allen Browne
Guest
 
Posts: n/a
Default 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.
  #5  
Old March 1st, 2007, 07:35 PM
Robert
Guest
 
Posts: n/a
Default 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.
>

 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles