display sum from subform to mainform

R

Revned

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
 
R

Revned

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
 
T

Tom Wickerath

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.


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

Revned said:
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
 
R

Revned

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 said:
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.


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

Revned said:
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
 
T

Tom Wickerath

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))


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

Revned

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 said:
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))


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

Revned said:
Yes thank you Tom Wickerath it works good now...

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

thanks again
 

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