Results 1 to 5 of 5
  1. #1
    w2vijay is offline Novice
    Windows XP Access 2000
    Join Date
    Feb 2010
    Location
    India
    Posts
    5

    Issue summing two field values

    Hi All,

    I am new to this forum and sending my first post where I am facing a small issue in summing two number fields.

    Field1 :
    Data Type: Number
    Format: Single
    Decimal :2
    Ex: 21.12

    Field2 :
    Data Type: Number
    Format: Single
    Decimal :2
    Ex:19.23

    I placed a text box in the report to sum field 1 and field 2 and put the result in textbox(=[field1]+[field2])

    The report is dispalying the total(40.35) when both the fields are having values,but showing blank when one of the field value is blank.



    Any ideas how to resolve this issue.

    Thanks in Advance.

  2. #2
    Rainlover's Avatar
    Rainlover is offline Expert
    Windows XP Access 2003
    Join Date
    Nov 2009
    Location
    Queensland Australia
    Posts
    691
    =nz([field1],0)+nz([field2],0)

  3. #3
    w2vijay is offline Novice
    Windows XP Access 2000
    Join Date
    Feb 2010
    Location
    India
    Posts
    5
    Hello Rain,

    Thanks for the reply,now I am able to get the sum when only one value is there out of two.I have placed the expression you have given in the controlsource of Total field.

    I tested the report with different values in the field1 and field2. Please find the results below.

    Test1
    Field1 : 22.52
    field2: 21.2
    Total: 43.72 (Correct)

    Test2
    Field1:blank
    Field2: 21.2
    Total: 21.2000001(Should be 21.2 - how to correct this?)

    Test3
    Field1:15.62
    Field2: blank
    Total: 15.62(correct)

    The only issue is with test2 result. Below are the definitions and properties I have set at Table level and report level.

    Table Level Definitions
    Field1 :
    Data Type: Number
    Format: Single
    Decimals:2
    Ex: 21.12
    Field2 :
    Data Type: Number
    Format: Single
    Decimals:2
    Ex:19.23

    Report level Definitons
    Field1 :
    Format: General Number
    Decimals:2
    Field2 :
    Format: General Number
    Decimals:2
    Total:
    Format: General Number
    Decimals:2

    Please let me know if any property of the Field1,field2 and Total has to be changed.

  4. #4
    Rainlover's Avatar
    Rainlover is offline Expert
    Windows XP Access 2003
    Join Date
    Nov 2009
    Location
    Queensland Australia
    Posts
    691
    You just need to format the result to 2 Decimal Places.

    Also if you only require 2 Decimal places then I would use Currency and format it not to show the Dollar sign.

  5. #5
    w2vijay is offline Novice
    Windows XP Access 2000
    Join Date
    Feb 2010
    Location
    India
    Posts
    5
    Thanks Rain,

    The sum is working fine. I set the total field format as standard with two decimals.

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

Similar Threads

  1. Urgent issue! Create field for intervals
    By Bjorn in forum Queries
    Replies: 3
    Last Post: 02-10-2010, 10:26 AM
  2. query field with multiple values
    By mknowles in forum Queries
    Replies: 1
    Last Post: 11-24-2009, 11:31 AM
  3. How to write field values next to each other?
    By Petefured in forum Programming
    Replies: 2
    Last Post: 09-23-2009, 02:39 PM
  4. summing values associated with date ranges
    By wdemilly in forum Reports
    Replies: 0
    Last Post: 07-17-2009, 01:53 PM
  5. clear field values
    By surrendertoo in forum Queries
    Replies: 0
    Last Post: 02-23-2008, 10:57 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