Results 1 to 4 of 4
  1. #1
    chriswrcg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2018
    Location
    Usa
    Posts
    142

    getting error result when field is 0

    In my DB I have to create a query that subtracts one number with another. Sometimes those numbers will be the same so the result should be 0. Access however is returning a very long number as an error. How can I set the field to allow 0 as a result?



    Here is my DB. Query in question is qryProductiveTime
    Attached Files Attached Files

  2. #2
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 10 Access 2016
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,538
    change your calculated field in the query to: TProductiveTime: Round([reportedtime]-[sumofeexceptionduration],0)

  3. #3
    chriswrcg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2018
    Location
    Usa
    Posts
    142
    Thank you sir. That did it.

  4. #4
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    It's not an error. The calculated value indicates E-14 which is a very small number with 13 zeroes after the decimal point then a value in the 14th digit.
    It occurs because of the many calculations done prior to that or because of how you defined the underlying number fields.
    For example if you use Double numbers you may get what is called floating point errors.

    Anyway to fix it, change your calculated expression to TProductiveTime: Int([reportedtime]-[sumofeexceptionduration])
    Using Int ensures the result is an integer and gives zero correctly in this case

    As a side issue, it is a bad idea to start object names with a number as you have for many queries.
    It may well cause you unexplained errors at some point
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

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

Similar Threads

  1. Replies: 16
    Last Post: 01-05-2016, 04:13 PM
  2. Replies: 3
    Last Post: 01-04-2015, 03:00 PM
  3. Replies: 4
    Last Post: 10-17-2014, 03:31 PM
  4. Error Message Result In Count Formula
    By EHittner in forum Forms
    Replies: 4
    Last Post: 10-22-2013, 10:52 AM
  5. Error Checking my Entry Result
    By AKQTS in forum Programming
    Replies: 3
    Last Post: 04-21-2011, 07:46 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