Error with form totals

S

Scott

I have a form/sub form that i'm trying to use SUM function in the subform
footer to total up a control on the sub form. I've done this many times
without any trouble. I'm getting the #Error in the total control in the
subform footer.

For a test, I used the formula in FORMULA 2 below and access returns the 1st
value on the subform and then divides by 2. But, if I try FORMULA 1, I get
the #Error.

This doesn't have anything to do with field data types because
COUNT([myIDfield]) also returns the #Error and myIDfield is an integer type.
This is an Access 2003 ADP file, but ADP forms should work just like regular
Access forms.

Any ideas on what I could be doing wrong?


FORMULA 1 (gives #Error):

=SUM([decDuration])


FORMULA 2 (works and just displays value of 1st value in subform divided by
2):
=([decDuration]*2)
 
M

Marshall Barton

Scott said:
I have a form/sub form that i'm trying to use SUM function in the subform
footer to total up a control on the sub form. I've done this many times
without any trouble. I'm getting the #Error in the total control in the
subform footer.

For a test, I used the formula in FORMULA 2 below and access returns the 1st
value on the subform and then divides by 2. But, if I try FORMULA 1, I get
the #Error.

This doesn't have anything to do with field data types because
COUNT([myIDfield]) also returns the #Error and myIDfield is an integer type.
This is an Access 2003 ADP file, but ADP forms should work just like regular
Access forms.

Any ideas on what I could be doing wrong?


FORMULA 1 (gives #Error):

=SUM([decDuration])


FORMULA 2 (works and just displays value of 1st value in subform divided by
2):
=([decDuration]*2)


It sounds like you are trying to sum a control instead of a
field.
 
S

scott

these controls are textboxes that have a field as their source.


Marshall Barton said:
Scott said:
I have a form/sub form that i'm trying to use SUM function in the subform
footer to total up a control on the sub form. I've done this many times
without any trouble. I'm getting the #Error in the total control in the
subform footer.

For a test, I used the formula in FORMULA 2 below and access returns the
1st
value on the subform and then divides by 2. But, if I try FORMULA 1, I get
the #Error.

This doesn't have anything to do with field data types because
COUNT([myIDfield]) also returns the #Error and myIDfield is an integer
type.
This is an Access 2003 ADP file, but ADP forms should work just like
regular
Access forms.

Any ideas on what I could be doing wrong?


FORMULA 1 (gives #Error):

=SUM([decDuration])


FORMULA 2 (works and just displays value of 1st value in subform divided
by
2):
=([decDuration]*2)


It sounds like you are trying to sum a control instead of a
field.
 
M

Marshall Barton

It's not clear what that means so I will reiterate.

The aggregate functions only operate on **fields** in the
form/report record source table/query. They are unaware of
**controls** on the form/report.

For example, let's say your table has the fields Price and
Quantity and the form/report detail section has a text box
named txtCost that has the expression =Price * Quantity

Your form/report footer text box can not use the
expression =Sum(txtCost).

Instead it must use the expression =Sum(Price * Quantity)
--
Marsh
MVP [MS Access]

these controls are textboxes that have a field as their source.


"Marshall Barton" wrote
Scott said:
I have a form/sub form that i'm trying to use SUM function in the subform
footer to total up a control on the sub form. I've done this many times
without any trouble. I'm getting the #Error in the total control in the
subform footer.

For a test, I used the formula in FORMULA 2 below and access returns the
1st
value on the subform and then divides by 2. But, if I try FORMULA 1, I get
the #Error.

This doesn't have anything to do with field data types because
COUNT([myIDfield]) also returns the #Error and myIDfield is an integer
type.
This is an Access 2003 ADP file, but ADP forms should work just like
regular
Access forms.

Any ideas on what I could be doing wrong?


FORMULA 1 (gives #Error):

=SUM([decDuration])


FORMULA 2 (works and just displays value of 1st value in subform divided
by
2):
=([decDuration]*2)


It sounds like you are trying to sum a control instead of a
field.
 

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