Microsoft Access Forums

Go Back   Microsoft Access Forums > Access Forums > Reports

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 02-09-2010, 07:48 PM
w2vijay w2vijay is offline Windows XP Access 2000 (version 9.0)
Novice
 
Join Date: Feb 2010
Location: India
Posts: 5
w2vijay is on a distinguished road
Send a message via Yahoo to w2vijay
Default 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.
Reply With Quote
  #2  
Old 02-09-2010, 08:40 PM
Rainlover Rainlover is offline Windows XP Access 2003 (version 11.0)
Competent Performer
 
Join Date: Nov 2009
Posts: 173
Rainlover is on a distinguished road
Default

=nz([field1],0)+nz([field2],0)
Reply With Quote
  #3  
Old 02-09-2010, 09:53 PM
w2vijay w2vijay is offline Windows XP Access 2000 (version 9.0)
Novice
 
Join Date: Feb 2010
Location: India
Posts: 5
w2vijay is on a distinguished road
Send a message via Yahoo to w2vijay
Default

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.
Reply With Quote
  #4  
Old 02-09-2010, 10:07 PM
Rainlover Rainlover is offline Windows XP Access 2003 (version 11.0)
Competent Performer
 
Join Date: Nov 2009
Posts: 173
Rainlover is on a distinguished road
Default

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.
Reply With Quote
  #5  
Old 02-09-2010, 10:53 PM
w2vijay w2vijay is offline Windows XP Access 2000 (version 9.0)
Novice
 
Join Date: Feb 2010
Location: India
Posts: 5
w2vijay is on a distinguished road
Send a message via Yahoo to w2vijay
Default

Thanks Rain,

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

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Urgent issue! Create field for intervals Bjorn Queries 3 02-10-2010 07:26 AM
query field with multiple values mknowles Queries 1 11-24-2009 08:31 AM
How to write field values next to each other? Petefured Programming 2 09-23-2009 12:39 PM
summing values associated with date ranges wdemilly Reports 0 07-17-2009 11:53 AM
clear field values surrendertoo Queries 0 02-23-2008 07:57 PM


All times are GMT -8. The time now is 02:41 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.