Results 1 to 9 of 9
  1. #1
    Pure Salt is offline Advanced Beginner
    Windows 7 32bit Access 2013
    Join Date
    Apr 2014
    Posts
    60

    Currency calculation in a datasheet form

    I have a query which multiplies the tonnes (3 decimal points) by the cost (2 decimal points), this then displays the 'total cost'.

    This works fine & rounds up/down correctly - until I add a 'sum' total field at the end of the datasheet form. It calculates the total cost using 3 decimal points & then converts to 2, which means it is sometimes a penny out.



    Any ideas please how I can get it to calculate the total using 2 decimal points instead of 3?

  2. #2
    burrina's Avatar
    burrina is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Hi, take a look at this link, I think it is what you are looking for. http://allenbrowne.com/round.html

    HTH

  3. #3
    Pure Salt is offline Advanced Beginner
    Windows 7 32bit Access 2013
    Join Date
    Apr 2014
    Posts
    60
    Thanks, tried this but it rounds down. I need it to round up if it is .5 or above.

  4. #4
    burrina's Avatar
    burrina is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    It also gave an example of Rounding up. Simply enter your criteria for the procedure.
    If (Me.SomeValue) > .5 Then
    'Do Something

  5. #5
    Pure Salt is offline Advanced Beginner
    Windows 7 32bit Access 2013
    Join Date
    Apr 2014
    Posts
    60
    The rounding part works, it's the 'total' line on the datasheet form that calculates the other totals using 3 decimal places rather than the 2 is shows.

    This is what it shows (The total of the 'total' column should be £102.58 - for eg if I click on the cell which shows £11.03 it then changes to £11.025):-
    Customer Rate Tonnes Total With VAT Month ID
    £12.00 0.50 £6.00 £7.20 7
    £12.00 1.58 £18.90 £22.68 7
    £12.00 0.63 £7.50 £9.00 7
    £12.00 1.38 £16.50 £19.80 7
    £12.00 1.25 £15.00 £18.00 7
    £6.00 4.61 £27.65 £33.18 7
    £9.00 1.23 £11.03 £13.23 7
    11.158 £102.57 £123.09

  6. #6
    burrina's Avatar
    burrina is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    I can't see your code that does the calculation for the values! Here is an example that may help. Example is in query.

    AmountEx: CCur(Nz(Round([tblTransDetail].[Quantity]*[tblTransDetail].[PriceEachEx],2),0))

  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Have you tried using Currency data type?
    This may help with some math issues in Access.

  8. #8
    Pure Salt is offline Advanced Beginner
    Windows 7 32bit Access 2013
    Join Date
    Apr 2014
    Posts
    60
    Thanks, I have just tried your example - it does work but it is still rounding down.

    My calculation is [Tonnes]*[Rate], so for eg 1.225 tonnes multiplied by £9 = £11.025, I need this to round up to £11.03 not down to £11.02

  9. #9
    Pure Salt is offline Advanced Beginner
    Windows 7 32bit Access 2013
    Join Date
    Apr 2014
    Posts
    60
    I have used Round(CDbl([Tonnes]*[Rate]+0.000001),2) & it seems to have done the trick!

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

Similar Threads

  1. Replies: 16
    Last Post: 09-12-2012, 08:39 AM
  2. Replies: 8
    Last Post: 08-26-2012, 11:11 PM
  3. Replies: 4
    Last Post: 05-04-2012, 03:41 PM
  4. Calculation in VB Code of Currency off by cents
    By DB2010MN26 in forum Programming
    Replies: 7
    Last Post: 12-13-2011, 03:59 PM
  5. Replies: 2
    Last Post: 03-23-2011, 11:43 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