Results 1 to 3 of 3
  1. #1
    Alex Motilal is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Nov 2008
    Location
    Coimbatore, India
    Posts
    192

    Subtraction Problem

    I have a Database which deals with the purchase of raw cotton and processing. In the table tblPurchase among various fields I have DateOfPurchase field and QtyPurchsed field. In the table tblGinning I do have DateOfGinning and QtyGinned fields among other fields.


    I do have a query qryGinning status. It pulls data from both the tables I have mentioned. The query calculates the total purchases and total ginned. In the calculated field which calculates the Balance Quantity available, for some records it gives the following type of results:

    Purchased Qty:1602.65
    Ginned Qty :1602.65

    Balance Qty :-2.27373675443232E-13 (Actual result should be 0)

    Among 24 records 6 records give such results instead of 0. All other records are correct.

    I will be very thankful if someone gives a solution.

    Regards
    Alex

  2. #2
    NTC is offline VIP
    Windows 7 64bit Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    Issue 1: If you are seeing the Balance Qty info in a form or report object - sanity check by stretching that box to be really wide. One of the quirks of Access is that if all the data cannot fit in a display field it will instead display an unhelpful piece of information like this (or xxxx depending on how the db has been optioned_

    Issue 2: The reason one is not getting 0 is because there is unseen decimals. I won't describe this as a quirk but it is confusing. What is stored in a table and what is viewed can be 2 different things.... particularly in regard to decimal places. In tables themselves - put your cursor in the field of one of these and you will probably then see it expand to display a lot more decimal places than you realize. Typically this is due to there have been some divisional math.

    The fix to issue 2 depends on where you are in the development of your database. If it is brand new and you still can alter your field properties, and delete test records and start from scratch - then it may be able to be dealt with at the table level. Otherwise one must get familiar with the Round function and apply rounding to whatever decimal level is appropriate for your business.

  3. #3
    Alex Motilal is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Nov 2008
    Location
    Coimbatore, India
    Posts
    192
    Thanks NTC
    The result shows in the Query itself. I am using Round function to set right. However the problem is when I try to retrieve data using criteria. For example if I want to know the balance quantity available above 100 quintals it gives the wrong results. Both the Purchase & Ginning Quantity is number field with two decimals. The peculiar thing is it is only adding and subtracting.

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

Similar Threads

  1. Formatting subtraction of two numbers.
    By accessmatt in forum Access
    Replies: 7
    Last Post: 10-24-2014, 01:14 PM
  2. Subtraction of Two Fields
    By shafi_sunshine in forum Queries
    Replies: 5
    Last Post: 12-09-2012, 07:01 AM
  3. Basic Subtraction in Access
    By akrasodomski in forum Access
    Replies: 11
    Last Post: 04-18-2012, 03:33 PM
  4. date subtraction in query
    By mejia.j88 in forum Queries
    Replies: 1
    Last Post: 03-29-2012, 02:28 PM
  5. subtraction between records
    By JJCHCK in forum Programming
    Replies: 5
    Last Post: 10-11-2011, 12:57 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