INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Calculating a sum whem some of the data is negative

Calculating a sum whem some of the data is negative

(OP)
I have a field in a subform labeled [Loss/Gain]. I need to put the sum on the main form. The numbers can be either positive or negative. I am using "Sum([Loss/Gain]) in the field. I know from reading other sources that summing on a calculated field may be a problem as well as negative numbers. Is there a work around I can use. Thanks very much.
Bill

RE: Calculating a sum whem some of the data is negative

I dont think that the negative numbers should be a problem.

you dont need to know the lable name or caption but the text box name

and use this on the main form =sum(forms!formname!subfromControlName!Textboxname)

RE: Calculating a sum whem some of the data is negative

(OP)
Thanks, PWISE; That is exactly what I did. When I try to run it, I get "ERROR". I have tried putting it on the main form, in the footer etc. All come back with "ERROR". [Loss/Gain] is a calculated field in the underlying query. I wonder if that has something to do with it.

RE: Calculating a sum whem some of the data is negative

The subform label doesn't have any value. Also, you can't sum a control. What is important is the field in the subform. I would add a control in the subform header or footer to calculate the total of the field. Set it's properties:
Name:txtMySum
Control Source: =Sum([Your Field Name Here])

Then in the main form, add a text box:
Control Source:=[Your Subform Control Name].[Form].[txtMySum]

Duane
Hook'D on Access
MS Access MVP

RE: Calculating a sum whem some of the data is negative

(OP)
thank you. That worked. Sorry, it took so long to try it. But, It worked!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close