Results 1 to 6 of 6
  1. #1
    MsAxes is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2021
    Posts
    100

    Why am I getting E-03 when subtracting fields?


    So I have two fields from two different tables. Both are number data type. I am subtracting to verify that they match and even though they do (ex. customer has 15646.23 in table 1 and 15646.23 in table 2) the result is not 0 as expected. I get -2.215654646E03.

    Anyone know why? and what can I do to avoid this and just get zero difference when numbers match?

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,906
    I would hazard a guess that they are not same exactly?
    Perhaps need to round to two decimal places?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,522
    there are flavors of number. you want SINGLE or DOUBLE to handle decimals.

  4. #4
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,002
    If the numbers are only specified to 2 decimal places you would be better to specify a Decimal number or use the currency number format.

    Double and Single can and do suffer from rounding errors, which is what you are seeing as a difference.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  5. #5
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,409
    or perhaps the fields are formatted to only display 2dp - remove the format and what do you see?

  6. #6
    MsAxes is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2021
    Posts
    100
    Thank you all for your comments. Both fields were Number data type (Double). Whats strange is that one of the fields was somehow returning 00.00000 although the data displayed the value as 00.00.

    It was a simple fix though - I just used the round expression and that fixed the issue.

    Thanks again

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

Similar Threads

  1. Subtracting dates
    By RunTime91 in forum Access
    Replies: 9
    Last Post: 10-17-2017, 05:22 PM
  2. Subtracting two records
    By laipeka in forum Queries
    Replies: 2
    Last Post: 08-30-2012, 04:12 AM
  3. Subtracting aggregate fields in a report
    By ProjectHelp in forum Access
    Replies: 6
    Last Post: 03-21-2012, 10:48 PM
  4. subtracting the value of fields in a form
    By petterros in forum Forms
    Replies: 0
    Last Post: 01-14-2011, 11:46 AM
  5. Subtracting Fields
    By zakslaher in forum Access
    Replies: 15
    Last Post: 03-30-2010, 09:36 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