Forms and suforms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an Orders main form with a subform similar to the Northwind orders
form but bigger. Both the main form and subform are based on multi-table
queries.

The subform default view is Datasheet and displays 12 controls. 3 controls
are based on calculated fields in the underlying query. A control displaying
the sum of each of these 3 controls is displayed in the footer of the
subform.
I wish to display this information in 3 controls on the main form as the
subform default view is Datasheet and the controls in the footer are not
displayed on the subform.

The problem I have is I get "#Name?" error in the controls on
the main form where I want to display the totals calculated in the controls
in the footer of the subform.

I've think I have done things according to the Acces help file "About
calculating totals in a subform and displaying it on a form", but I can't get
it to work.

Any suggestions gratefully accepted.

Thanks in advance.
 
Paulu,

As there are a couple of approaches to doing this, could you
supply some more details of how exactly you are attempting
to do it? The #NAME error can commonly result from small
errors in the syntax of how you are referring to your
controls, especially when you are referencing things in a
subform or from a subform to a parent form.
 
Gary,

The query which is the record source for the subform has 3 calculated fields
one of which I put in below.

ExtendedPrice:
([UnitSellPrice]+[UnitCostFIS])*[ShippedQuantity]*(1-[Discount])

The other 2 are similar.

The footer of the subform has a control with the name;

TotalProductSell

and the control source;

=Sum([ExtendedPrice])

The main form has a control which has a control with the name;

InvoiceSubtotal

and control source;

=[frmOrderSubform].[Form]![TotalProductSell]


And I continue to get #Name? apearing in my control.

If you can help that would be great.

Cheers
 
Palau,

The name of your subform is frmOrderSubform right? What is
the name of your subform control that displays the subform?
That is the name that you need to use in the subform
reference, not the name of the subform itself.

=[NameOfSubFormControl].Form!TotalProductSell
[/QUOTE]
The main form has a control which has a control with the
name;

InvoiceSubtotal

and control source;


=[frmOrderSubform].[Form]![TotalProductSell]


And I continue to get #Name? apearing in my control.[/QUOTE]
 
Thanks Gary,

That was my problem. The name of the control that displays the subform is
different to the name of the form. It works fine now.

Thanks again,

Cheers,
--
paulu


Gary Miller said:
Palau,

The name of your subform is frmOrderSubform right? What is
the name of your subform control that displays the subform?
That is the name that you need to use in the subform
reference, not the name of the subform itself.

=[NameOfSubFormControl].Form!TotalProductSell
The main form has a control which has a control with the
name;

InvoiceSubtotal

and control source;


=[frmOrderSubform].[Form]![TotalProductSell]


And I continue to get #Name? apearing in my control.[/QUOTE]
[/QUOTE]
 
Back
Top