Referencing a control in a nested subform

T

Tom Ross

This is for an PO and Receiving database

I have a main form, Porder, based on the Porder table (Purchase order
details)

I have a subform, OrderLineSubform2, based on the OrderLine table linked to
the main form by PONumber. This is displayed in single form view. User can
page through each line on the PO

The detail section of OrderLineSubform2 contains a subform,
ReceivedSubform2, based on the Received table and linked to
OrderLineSubform2 by PONumber and LineNumber, It is displayed as a
datasheet. there is a control in the form footer of the subform
'txtRcdSum' that calculates the sum of the received records on the form
'=sum([qtyreceived])'

The subforms and the sum work as expected.

I want to take the value from txtRcdSum (from ReceivedSubform2) and put in
a textbox in the detail section of OrderLineSubform2. I did this before
with a subform and a main form (not with the third nested form) with a data
source =[ReceivedSubform2].Form![txtRcdSum]. When I use this from the
subform to its subform I get #Name? error.

What other bits, dots, bangs and forms do I need to make that work.

Thanks

Tom
 
D

Dirk Goldgar

Tom Ross said:
This is for an PO and Receiving database

I have a main form, Porder, based on the Porder table (Purchase order
details)

I have a subform, OrderLineSubform2, based on the OrderLine table
linked to the main form by PONumber. This is displayed in single form
view. User can page through each line on the PO

The detail section of OrderLineSubform2 contains a subform,
ReceivedSubform2, based on the Received table and linked to
OrderLineSubform2 by PONumber and LineNumber, It is displayed as a
datasheet. there is a control in the form footer of the subform
'txtRcdSum' that calculates the sum of the received records on the
form '=sum([qtyreceived])'

The subforms and the sum work as expected.

I want to take the value from txtRcdSum (from ReceivedSubform2) and
put in a textbox in the detail section of OrderLineSubform2. I did
this before with a subform and a main form (not with the third nested
form) with a data source =[ReceivedSubform2].Form![txtRcdSum].
When I use this from the subform to its subform I get #Name? error.

What other bits, dots, bangs and forms do I need to make that work.

Thanks

Tom

So form "Porder" contains "OrderLineSubform2" which contains
"ReceivedSubform2", the text box "txtRcdSum" is on ReceivedSubform2, and
you want to refer to it from a text box on OrderLineSubform2?

As far as I can see, your proposed ControlSource,

=[ReceivedSubform2].Form![txtRcdSum]

should work, provided that "ReceivedSubform2" is really the name of the
subform control on OrderLineSubform2, and not just the name of the form
object displayed by that control -- they may be different. Verify the
name of the subform control.
 
T

Tom Ross

I checked and rechecked the name then renamed and renamed back and finally
it worked with just the controlsource I proposed.

The computer spirits were messing with my mind again

Thanks for your encouragement. I stopped trying every combination of
me.form.forms!form!form()!!!...! I could think of


Dirk Goldgar said:
Tom Ross said:
This is for an PO and Receiving database

I have a main form, Porder, based on the Porder table (Purchase order
details)

I have a subform, OrderLineSubform2, based on the OrderLine table
linked to the main form by PONumber. This is displayed in single form
view. User can page through each line on the PO

The detail section of OrderLineSubform2 contains a subform,
ReceivedSubform2, based on the Received table and linked to
OrderLineSubform2 by PONumber and LineNumber, It is displayed as a
datasheet. there is a control in the form footer of the subform
'txtRcdSum' that calculates the sum of the received records on the
form '=sum([qtyreceived])'

The subforms and the sum work as expected.

I want to take the value from txtRcdSum (from ReceivedSubform2) and
put in a textbox in the detail section of OrderLineSubform2. I did
this before with a subform and a main form (not with the third nested
form) with a data source =[ReceivedSubform2].Form![txtRcdSum].
When I use this from the subform to its subform I get #Name? error.

What other bits, dots, bangs and forms do I need to make that work.

Thanks

Tom

So form "Porder" contains "OrderLineSubform2" which contains
"ReceivedSubform2", the text box "txtRcdSum" is on ReceivedSubform2, and
you want to refer to it from a text box on OrderLineSubform2?

As far as I can see, your proposed ControlSource,

=[ReceivedSubform2].Form![txtRcdSum]

should work, provided that "ReceivedSubform2" is really the name of the
subform control on OrderLineSubform2, and not just the name of the form
object displayed by that control -- they may be different. Verify the
name of the subform control.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
D

Dirk Goldgar

Tom Ross said:
I checked and rechecked the name then renamed and renamed back and
finally it worked with just the controlsource I proposed.

The computer spirits were messing with my mind again

LOL ... I hate when they do that!

One possibility, maybe, is that you have the Name Autocorrect option
turned on and it was "helpfully" renaming the subform behind the scenes.
Just a conjecture ...
 
T

Tom Ross

Name AutoCorrect? I found the settings. But now I can't get the error back
to see if that was behind it. ;-)}
Enjoy your weekend and thanks



Tom
 

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