How to display the TOTAL of a sub form on the parent Form?

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

on my sub form (subDetails) I have a totals column.
I then Total the totals column in the footer of the subform in a field named
(txtOrderTotal)

I want to display that total on the Parent form (frmOrders)
(I do not want to just show the footer of the sub form due to placment
issues)

So on my parrent form I have a text box with this code in the control source

=Forms!subDetails.txtOrderTotal

BUT all I get is "#NAME?!"

I have doubled checked my spelling.

Am I going about this wrong?

Any help here will be appreciated.

Thanks in advance
Dave
 
on my sub form (subDetails) I have a totals column.
I then Total the totals column in the footer of the subform in a field named
(txtOrderTotal)

I want to display that total on the Parent form (frmOrders)
(I do not want to just show the footer of the sub form due to placment
issues)

So on my parrent form I have a text box with this code in the control source

=Forms!subDetails.txtOrderTotal

BUT all I get is "#NAME?!"

I have doubled checked my spelling.

Am I going about this wrong?

Any help here will be appreciated.

Thanks in advance
Dave

It's the name of the subform control you need reference, not the name
of the form used as the sub form.

Access gives these controls a default name of "Child1", "Child2", etc.
You can rename them as you wish.

Set the control's Control Source to:
=[Name of the Subform control on the main form].[Form]![txtOrderTotal]
 
Hi Dave!

When you reference a control on a subform from the main form, you do it
through the subform control on the main form:
=Me!NameOfSubformControl.Form!TxtOrderDetail

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
(e-mail address removed)
 
Steve said:
Hi Dave!

When you reference a control on a subform from the main form, you do it
through the subform control on the main form:
=Me!NameOfSubformControl.Form!TxtOrderDetail

PC Datasheet

Hi Steve !!

This is to inform 'newbees' here about PCD' Steve:
http://home.tiscali.nl/arracom/whoissteve.html
Until now 3650+ pageloads, 2350+ first-time visitors (these figures are rapidly increasing)

Why is this ???
Because Steve is the ONLY person here who continues to advertise in the groups.

It is not relevant whether he advertised in *this* particular post or not...
==> We want him to know that these groups are *not* his private hunting grounds!

For those who don't like too see all these messages:
==> Simply killfile 'StopThisAdvertising'.
Newbees will still see this warning-message.

ArnoR
 
Fred,

Thanks for the reply.
However I am still confused. I guess I do not know what you mean by the
sub-form "control"

Can you elaborate?

Thanks

Dave

fredg said:
on my sub form (subDetails) I have a totals column.
I then Total the totals column in the footer of the subform in a field
named
(txtOrderTotal)

I want to display that total on the Parent form (frmOrders)
(I do not want to just show the footer of the sub form due to placment
issues)

So on my parrent form I have a text box with this code in the control
source

=Forms!subDetails.txtOrderTotal

BUT all I get is "#NAME?!"

I have doubled checked my spelling.

Am I going about this wrong?

Any help here will be appreciated.

Thanks in advance
Dave

It's the name of the subform control you need reference, not the name
of the form used as the sub form.

Access gives these controls a default name of "Child1", "Child2", etc.
You can rename them as you wish.

Set the control's Control Source to:
=[Name of the Subform control on the main form].[Form]![txtOrderTotal]
 
Dave,

Open FrmOrders in design view. You will see a white box where the subform is
at. That is the subform control. Select it then open properties and go to
the Other tab. You will see the name of the subform control on the first
line - the Name property.

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
(e-mail address removed)




Dave said:
Fred,

Thanks for the reply.
However I am still confused. I guess I do not know what you mean by the
sub-form "control"

Can you elaborate?

Thanks

Dave

fredg said:
on my sub form (subDetails) I have a totals column.
I then Total the totals column in the footer of the subform in a field
named
(txtOrderTotal)

I want to display that total on the Parent form (frmOrders)
(I do not want to just show the footer of the sub form due to placment
issues)

So on my parrent form I have a text box with this code in the control
source

=Forms!subDetails.txtOrderTotal

BUT all I get is "#NAME?!"

I have doubled checked my spelling.

Am I going about this wrong?

Any help here will be appreciated.

Thanks in advance
Dave

It's the name of the subform control you need reference, not the name
of the form used as the sub form.

Access gives these controls a default name of "Child1", "Child2", etc.
You can rename them as you wish.

Set the control's Control Source to:
=[Name of the Subform control on the main form].[Form]![txtOrderTotal]
 
Fred,

Thanks for the reply.
However I am still confused. I guess I do not know what you mean by the
sub-form "control"

Can you elaborate?

Thanks

Dave

fredg said:
on my sub form (subDetails) I have a totals column.
I then Total the totals column in the footer of the subform in a field
named
(txtOrderTotal)

I want to display that total on the Parent form (frmOrders)
(I do not want to just show the footer of the sub form due to placment
issues)

So on my parrent form I have a text box with this code in the control
source

=Forms!subDetails.txtOrderTotal

BUT all I get is "#NAME?!"

I have doubled checked my spelling.

Am I going about this wrong?

Any help here will be appreciated.

Thanks in advance
Dave

It's the name of the subform control you need reference, not the name
of the form used as the sub form.

Access gives these controls a default name of "Child1", "Child2", etc.
You can rename them as you wish.

Set the control's Control Source to:
=[Name of the Subform control on the main form].[Form]![txtOrderTotal]

When you create a form and add a subform to it, you first add a
subform control. That is the control whose name you need to refer to.
Open your form in Design View. Display the form's property sheet.
Click on the edge of the space where the subform is. Read the object
name in the property sheet caption.
If it says "Subform/Subreport XXXXXX" then the XXXXXX is the name you
need. If it doesn't say "Subform/Subreport XXXXXX" then keep clicking
around the edge until you find it.
When you find it you can verify that it is the subform control by
looking at the properties available on the Data tab. You should see
Source Object, Link Child Field, and Link Master Field as the first 3
properties shown on that tab.
 
lol - I checked all my spelling cuse I am a bad speller
BUT
I used Forms!
instead of Form!

Problem solved.

Thanks much,

dave
 
Dave,

For future reference ---

You actually only lucked out changing Forms to Form. Check again my response
and fredg's response. You don't reference the subform you reference the
subform control on the main form. What caused you to luck out is that Access
names a subform control with the same name as the subform by default.
Therefore, when you changed Forms to Form, your expression was actually
referencing the subform control and not the subform. If you go into your
form and change the name of your subform, you will find that your expression
will no longer work.

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
(e-mail address removed)
 
Back
Top