Results 1 to 2 of 2

Thread: Weird ADODB Recordset/Access Issue - loss of precision?

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2009
    Posts
    4

    Weird ADODB Recordset/Access Issue - loss of precision?

    Hi guys

    I've got a strange issue with an ADODB Recordset and an Access database

    Basically the Access table is populated from a SQL Server table, and is then read back at a later point into an ADODB recordset.

    My problem is that the ADODB recordset seems to lose precision after a filter is applied to the recordset... e.g:

    Access table shows following values:
    DetailId Description Quantity
    120191 ABC 179.2224
    120601 DEF 176.4
    120812 GHI 1.176
    120813 JKL 0.3528
    120815 MNO 0.3528

    The problem is, I iterate through the recordset using a criteria ("[DetailId] = '" & rstHistoricData!DetailId & "'")

    This filters the recordset. I then check the values. This is where it gets a bit strange. For all the records above, rstTestData!Quantity is accurate (eg 179.2224), but when I get to the last two, rstTestData!Quantity shows as being 0, ie it loses its precision.

    I can't think why this is, in fact I'm completely stumped.

    The access field is a "double"... I've tried CDbl(rstTestData!Quantity), and Format(rstTestData!Quantity, "#.#####") but with no success.

    Anyone got any ideas?

    Seems almost like it's rounding 0.3528 down to 0, yet it can't be as it's ok for 179.2224

    Any help appreciated

  2. #2

    Thread Starter
    New Member
    Join Date
    Apr 2009
    Posts
    4

    Re: Weird ADODB Recordset/Access Issue - loss of precision?

    OK, typical, I make my first post on here and then figure it out two seconds later!

    Maybe it's more of a workaround though so would be interesting to see what you guys think...

    The recordset with the issues (rstTestData) is populated by getting the values from a SQL Server database, updating the recordset, then using the recordset to populate an Access database table.

    The recordset is then used to compare values against other stored SQL Server values in another recordset.

    My fix was to, after populating the Access database table using rstTestData, then go back and repopulate rstTestData from the Access table - kinda like refreshing the recordset.

    After this, the "precision" is fine, i.e. 0.3528 shows as 0.3528 and not 0.

    Not sure what the cause is, but I have the fix.

    If anyone can elaborate please feel free



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width