Results 1 to 7 of 7
  1. #1
    TimC is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    34

    Calculated Sum in Form

    I am trying to create a calculated field in a form that will total or sum 6 different fields pulled from either the form or associated query. In some cases, the fields may be null or contain a value. The value of null will always be zero. I have already tried the following:

    ProposedPenalty:[Fine1]+[Fine2]+[Fine3]+[Fine4]+[Fine5]+[Fine6], but this only works if/when all fields contain a value. I have also attempted to add Nz([Fine1],0) +NZ([Fine2],0) +NZ([Fine3],0) +NZ([Fine4],0) +NZ([Fine5],0) + NZ([Fine6],0) into the control source line, but I did not have any luck. I am a newbie and simply need some help. Any suggestions? Thanks.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    Expression looks fine to me. What do you mean by 'did not have any luck' - error message, wrong results, nothing?

    If you want to provide db for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    TimC is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    34
    Please see the attached dB..... Is there any cost to you looking at my dB? If so, I may need to rethink this. Thanks.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    Place an = sign at beginning of expression in ControlSource. See the little box with ! mark next to control? This is providing a note about this error.

    No cost, participation in forum is voluntary for posters and responders.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    Quote Originally Posted by TimC View Post
    I am trying to create a calculated field in a form that will total or sum 6 different fields pulled from either the form or associated query. In some cases, the fields may be null or contain a value. The value of null will always be zero. I have already tried the following:

    ProposedPenalty:[Fine1]+[Fine2]+[Fine3]+[Fine4]+[Fine5]+[Fine6], but this only works if/when all fields contain a value. I have also attempted to add Nz([Fine1],0) +NZ([Fine2],0) +NZ([Fine3],0) +NZ([Fine4],0) +NZ([Fine5],0) + NZ([Fine6],0) into the control source line, but I did not have any luck. I am a newbie and simply need some help. Any suggestions? Thanks.
    You need an equals sign = before the expression.
    = Nz([Fine1],0) +NZ([Fine2],0) +NZ([Fine3],0) +NZ([Fine4],0) +NZ([Fine5],0) + NZ([Fine6],0)
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  6. #6
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    Sorry June7. You type too fast.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  7. #7
    TimC is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    34
    Thank you.

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

Similar Threads

  1. Replies: 1
    Last Post: 03-27-2012, 05:25 PM
  2. Calculated field for table not form
    By cheyanne in forum Access
    Replies: 1
    Last Post: 01-27-2012, 07:29 AM
  3. Calculated fields in form
    By speckytwat in forum Access
    Replies: 15
    Last Post: 04-27-2011, 05:01 PM
  4. Replies: 1
    Last Post: 11-12-2010, 06:33 PM
  5. Filter a Form Using Calculated Tx Box?
    By TxTcher in forum Forms
    Replies: 1
    Last Post: 08-12-2010, 06:49 AM

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