Results 1 to 2 of 2
  1. #1
    NJ-Tom is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2016
    Location
    Westfield, NJ
    Posts
    9

    Question Getting strange results subtracting doubles

    I am having a strange result.


    I'm using Microsoft 365, and W10 both up-to-date.

    I have a function I use for rounding up hours worked. Hours are to be rounded to the next 15 minutes, therefore I need to separate the time fraction to compute the rounding.
    Function RoundSecurity(ByVal dblHrs As Double) As Double
    Dim dblFraction As Double 'Fraction of hours
    Dim dblBefore As Double 'Hold area for the incoming hours\
    Dim iHrs As Integer


    coming in to the Function dblHrs = 10.5

    after executing this code

    dblBefore = dblHrs
    iHrs = Int(dblHrs)
    dblFraction = dblBefore = iHrs


    dblfraction is = 0 where it should be .5, no?
    I know moving dblhrs to dblbefore looks strange, but I did that because when I used dblHrs directly I got the same result.

    Help I can't figure this out. Even more confusing, sometimes the answer (dblFraction) comes up as -1

  2. #2
    NJ-Tom is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2016
    Location
    Westfield, NJ
    Posts
    9
    Never mind!, but thanks for looking. I saw that instead of the - I had an =. no wonder I was getting -1 some time.

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

Similar Threads

  1. Very Strange Results Access report to Word
    By gbeegle in forum Reports
    Replies: 1
    Last Post: 06-23-2020, 02:02 PM
  2. Query giving strange results
    By deepakg27 in forum Queries
    Replies: 3
    Last Post: 02-11-2018, 11:17 AM
  3. Replies: 8
    Last Post: 09-19-2016, 08:25 PM
  4. Replies: 5
    Last Post: 10-27-2011, 09:08 PM
  5. Strange report results
    By DDows in forum Reports
    Replies: 5
    Last Post: 01-10-2011, 06:43 PM

Tags for this Thread

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