Results 1 to 8 of 8
  1. #1
    kwooten is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2011
    Posts
    255

    formula in text box problem


    If I do Sum(January Gain) I get values. There are no values for January loss, but when I do Sum(January Gain)- Sum(January Loss) I get blank data. What am I missing?

  2. #2
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    Try this:
    Sum(nz([January Gain]),0) - Sum(nz([January Loss]),0)
    The nz function puts a Zero in if any of your values are Null. Access can then calculate properly.
    Let us know if this helps.

  3. #3
    kwooten is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2011
    Posts
    255
    Syntax error (comma) in query expression...

    Should I go into my query and make the null values for "January loss" 0?

  4. #4
    kwooten is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2011
    Posts
    255
    Should I go into my query and make the null values for "January loss" 0?

    This didnt work either.

  5. #5
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    My bad - sorry.

    Try this:
    Sum(nz([January Gain],0)) - Sum(nz([January Loss],0))

    Let me know if that works

  6. #6
    kwooten is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2011
    Posts
    255
    Quote Originally Posted by kwooten View Post
    Should I go into my query and make the null values for "January loss" 0?

    This didnt work either.
    Actually, this did work..

  7. #7
    kwooten is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2011
    Posts
    255
    Quote Originally Posted by Robeen View Post
    My bad - sorry.

    Try this:
    Sum(nz([January Gain],0)) - Sum(nz([January Loss],0))

    Let me know if that works
    This worked... thanks! saved me from editing all that data.

  8. #8
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    To answer your question:

    Should I go into my query and make the null values for "January loss" 0?
    I usually use the Nz()function in my queries so I'm sure that the reports are getting no Nulls.

    I would put this:

    Code:
     
    Balance: nz([January Gain],0) - nz([January Loss],0)
    in a new field in my query in Query Design View.


    Then I would just pull the Balance field from the query into my report.

    The only calculations I leave to the reports are usually just the Group Totals and the Grand Totals.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Text/Number Relationship Problem
    By Luke in forum Access
    Replies: 4
    Last Post: 07-07-2011, 11:29 AM
  2. Formula mod help
    By jcaptchaos2 in forum Access
    Replies: 2
    Last Post: 04-25-2011, 02:55 PM
  3. SQL Formula to Sum Itself
    By Scorpio11 in forum Access
    Replies: 1
    Last Post: 02-19-2011, 11:22 AM
  4. Imput Mask problem (TEXT)
    By Danzig in forum Forms
    Replies: 3
    Last Post: 10-28-2010, 06:47 PM
  5. Formula
    By hschrunk in forum Access
    Replies: 3
    Last Post: 05-18-2010, 01:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums