Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397

    Smile Unanswered: Data Truncation - Error 3759

    Hi,

    Subject error is appearing at one of the below code line. The environment is ODBC tables linked in MS Access db.

    rst!AvgPurPrice = Round(AvgPrice, 2)

    The AvgPrice holds value 7.08333333333333
    And AvgPurPrice is storing value 7 when I end up with code (no debug).

    By the way the complete description of the error is "Scaling of decimal value resulted in data truncation"

    What could be the solution?

    With kind regards,
    Ashfaque

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Why not try break it down a wee bit
    Code:
    Dim x
    x = Round(AvgPrice, 2)
    MsgBox x
    rst!AvgPurPrice = x
    I think that when you're rounding you're value is being returned as 7.080000000 which is not what you want. Try a few test like the above to determine if this is true.
    George
    Home | Blog

  3. #3
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    This apparently is a problem when using an ODBC connection.

    From another site:
    This is a MS Access error caused when 2 or more decimal columns are being totalled and where the result could cause an overflow to the value to the right of the decimal point. Most other applications will simply round or truncate the result without a hard halt, unfortunately MS Access does a hard halt and the query ends.

    A workaround to this problem is to use the CDBL Function
    Using the CDBL function to cast the data as a Double, as suggested above, is also Micro$oft's official answer to the problem. From various postings online it appeared that sometimes this works and sometimes it doesn't.

    Good Luck
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397
    Thanks Georg for your code.

    I tried with CDbl as per Missinglinq and it worked perfectly.

    But now I have anoter problem. Not becuae of I used CDbl but reason I am trying to. The problem is now process of retrieving data is slow.

    The codes are same when tables were placed locally and were retrieving data very fast at a subform thur combo. But since I put them on Server and linked thru ODBC, the performance is too slow.

    Any guidelines?

    With kind regards,
    Ashfaque

  5. #5
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    I'm wondering if you need to change the data type on SQL Server to Float or Real.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  6. #6
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397
    I think the same way pkstormy.

    But float provides only 9 digit. Does it mean it can carry out until 9 digits only including decimals? If not then how can I set only 2 decimals with it?

    With kind regards,
    Ashfaque

Posting Permissions

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