Results 1 to 7 of 7
  1. #1
    DeeCee is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Oct 2018
    Location
    Auckland NZ
    Posts
    17

    Different results Access 2.0 to 2016

    @ridder52 very kindly converted my Access 2.0 db to 2016. It's an accounting package for my business. I'm getting a slightly different result ($1.20) when running a summary of all outgoing transactions. Incoming is fine.

    There's 22,000-odd entries, basically quantity, cost and tax, which may be 0. Grand total is circa $3.5M, so it's tiny discrepancy.

    The sum of the entries that don't have tax seem to be ok, so there must be something very slightly different in the way the two programs are calculating this. None of the queries or calculations have been changed.



    Can anyone shed some light on this?

    Cheers

  2. #2
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    $1.20 discrepancy in $3.5 million!! Peanuts!

    Although I did the conversion for you, without looking at your code I've got no idea how the calculation was done.
    Others will have even less idea!

    So please can you explain how the calculation was done including any formatting used in each step e.g. Round / Fix / Int / Abs etc
    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!

  3. #3
    DeeCee is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Oct 2018
    Location
    Auckland NZ
    Posts
    17
    Quote Originally Posted by ridders52 View Post
    $1.20 discrepancy in $3.5 million!! Peanuts!

    Although I did the conversion for you, without looking at your code I've got no idea how the calculation was done.
    Others will have even less idea!

    So please can you explain how the calculation was done including any formatting used in each step e.g. Round / Fix / Int / Abs etc
    Lol I know, I'm not losing sleep over it, just my mild OCD kicking in. I'll have a dig, see what I can find. Cheers

  4. #4
    DeeCee is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Oct 2018
    Location
    Auckland NZ
    Posts
    17
    Here's the query:

    Click image for larger version. 

Name:	query.jpg 
Views:	12 
Size:	38.7 KB 
ID:	36142

    Everything identical in both dbs

  5. #5
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    I'll look at it later as I still have the files.
    I expect it may well be the effects of rounding and then summing the rounded values.

    Two questions for now
    1. Any idea which version is 'correct'.....if either is?
    2. Two of your expressions here have CLng(....*100/100). Why?
    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!

  6. #6
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    Unable to investigate as I only have the FE files.

    Two of your expressions here have CLng(....*100/100). Why?
    What happens if you remove all of that?

    So instead of:
    Code:
    SELECT DISTINCTROW costs.record, costs.date, CVDate(Format([date],"mmm yyyy")) AS mnth, costs.account, costs.inv, costs.merch, costs.product, costs.quantity, costs.cost, costs.discount, costs.cashbook, costs.[chq no], CLng(([quantity]*[cost]*(1-[discount]))*100)/100 AS [net total], costs.[gst rate], CLng(([net total]*[gst rate])*100)/100 AS gst, [net total]+[gst] AS [total inc gst], costs.[chq presented?]
    FROM costs;

    you use:
    Code:
    SELECT DISTINCTROW costs.record, costs.date, CVDate(Format([date],"mmm yyyy")) AS mnth, costs.account, costs.inv, costs.merch, costs.product, costs.quantity, costs.cost, costs.discount, costs.cashbook, costs.[chq no], ([quantity]*[cost]*(1-[discount]) AS [net total], costs.[gst rate], ([net total]*[gst rate]) AS gst, [net total]+[gst] AS [total inc gst], costs.[chq presented?]
    FROM costs;
    You should never use calculated values in others field in the same query as it can create unpredictable results.
    You have reused both [net total] and gst.
    Either create a second query for calculating those values or set out the calculation in full each time

    So the second version above would become:
    Code:
    SELECT DISTINCTROW costs.record, costs.date, CVDate(Format([date],"mmm yyyy")) AS mnth, costs.account, costs.inv, costs.merch, costs.product, costs.quantity, costs.cost, costs.discount, costs.cashbook, costs.[chq no], ([quantity]*[cost]*(1-[discount]) AS [net total], costs.[gst rate], (([quantity]*[cost]*(1-[discount])*[gst rate]) AS gst,([quantity]*[cost]*(1-[discount])+(([quantity]*[cost]*(1-[discount])*[gst rate]) AS [total inc gst], costs.[chq presented?]
    FROM costs;
    When you look at that you may well realise that the [total inc gst] expression could probably be simplified!

    Who knows what the outcome will be after you make those changes ... but it probably will be different

    Also look at the number of decimal places and number format used for each field
    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!

  7. #7
    DeeCee is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Oct 2018
    Location
    Auckland NZ
    Posts
    17
    Cheers. I really don't know why I used the CLng thing. It was 24 years ago lol, and I've hardly played with Access since. I will have a play when I get time and use your suggestions. It's actually served us very well in all those years and always reconciled.

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

Similar Threads

  1. Replies: 4
    Last Post: 08-07-2018, 05:38 AM
  2. Automating Outlook 2016 from Access 2016
    By jcc285 in forum Programming
    Replies: 10
    Last Post: 09-30-2017, 01:53 PM
  3. Replies: 5
    Last Post: 06-01-2017, 04:22 PM
  4. Replies: 3
    Last Post: 01-06-2017, 08:15 AM
  5. ODBC connection for Access 2016 - results in error
    By Ashish_Panchal in forum Access
    Replies: 3
    Last Post: 11-25-2016, 01:35 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