Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

display sum from subform to mainform

7 views
Skip to first unread message

Revned

unread,
Jan 3, 2010, 6:28:01 AM1/3/10
to
I have a subform qryOrder subform under
Form footer I have a txtTotal that sum the order amount field
i want to display the result in main form how to accomplish it?

thanks anyway

Tom Wickerath

unread,
Jan 3, 2010, 6:44:01 AM1/3/10
to
Hi Revned,

Try this tutorial:
Displaying Subtotals and a Grand Total on a Form
That Displays a One-to-Many Relationship
http://www.access.qbuilt.com/html/subtotals.html


Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
__________________________________________

Revned

unread,
Jan 3, 2010, 8:22:01 AM1/3/10
to
Hi, Tom Wickerath

this what i deed as what i understand from the example
I make a textbos under the subform Form Footer
with a contro sourcer =sum([Amount])

I have this syntax in my main form
=[qryOrder subform].txtTotal

but still no result is being display

i also try doing
=[qryOrder subform].[frmOrders]!txtTotal

but still no luck

what else do I miss here???

thanks

Tom Wickerath

unread,
Jan 4, 2010, 1:23:01 AM1/4/10
to
Hi Revned,

> this what i did as what i understand from the example
> I make a textbox under the subform Form Footer
> with a control source =sum([Amount])

Open this form by itself (ie. not as a subform), in continuous view (or form
view), but not in datasheet view. Do you see a sum correctly calculated? What
I'm asking you to verify is that you see a total similar to that shown in
Figure 4 of my tutorial.

> I have this syntax in my main form
> =[qryOrder subform].txtTotal
>
> but still no result is being display
>
> i also try doing
> =[qryOrder subform].[frmOrders]!txtTotal

But neither of these forms that you tried are correct. You need something
like this:

=[NameOfSubformObject].[Form]![NameOfTextboxInSubform]

If the name of the control that holds your subform is "qryOrder subform",
then you need to use this:

=[qryOrder subform].[Form]![txtTotal]

Note: The .[Form]! part shown in the middle will never change. It has to
be exactly this, *not* the name of the form.

Revned

unread,
Jan 4, 2010, 5:54:02 AM1/4/10
to
Yes thank you Tom Wickerath it works good now...

but the problem is how to avoid #Error when the Amount = 0??

thanks again

Tom Wickerath

unread,
Jan 5, 2010, 2:45:01 AM1/5/10
to
If the amount is equal to zero, you shouldn't get an error, since 0 is a
valid number. Did you possibly mean that you are getting an error with nulls?

If so, try this:

=sum(Nz([Amount], 0))

Revned

unread,
Jan 6, 2010, 1:51:01 AM1/6/10
to
Sorry this what I mean

I have a cmbName and subform frmOrdersubfrom i my main form
I have #Error result from txtAmount when no records are selected
from the cmbName...

is there a way to handle this??

thanks again

"Tom Wickerath" wrote:

Tom Wickerath

unread,
Jan 11, 2010, 12:55:01 AM1/11/10
to
Sorry about the late reply. Without seeing a copy of your database, it is
really hard to say what is causing this error. Have a look at this KB article
to see if it is helpful:

Troubleshooting Tips for Error Values
http://support.microsoft.com/kb/209132

Note: Disregard the "ACC2000" in the title.

0 new messages