Results 1 to 4 of 4
  1. #1
    inhops is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2011
    Posts
    13

    Include zero after decimal in text string

    I have an Access query that calculates a cost. I then need to append USD after the cost. I want a calculation that results in 24.7 to end up as a text string "24.70 USD". It is appearing as "24.7 USD". I tried doing the calculation in a separate field with the field formatted as Fixed:2 and then using this field in the - but it still doesn't work.

    1st attempt:
    FormattedAmt: Round(Price*1.08,2) & " USD"
    2nd attempt:
    Amt: Round(Price*1.08,2) - field is formatted as Fixed:2
    FormattedAmt: Amt & " USD"



    I was trying to do it all in a query, but if I need to add a function, I can do that. Other than converting each position of the number to text, is there a way to do this?

    Thanks for the help!

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Use the FORMAT function. It coerces it to Text, so it retains trailing zeroes, i.e.

    FormattedAmt: FORMAT(ROUND([Price]*1.08,2),"0.00") & " USD"

  3. #3
    inhops is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2011
    Posts
    13
    Thank you so much for the quick reply. This is perfect! Now I get "24.70 USD". Such an easy fix and yet so difficult to get via a Google search.

  4. #4
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Your welcome. Glad it all worked out!

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

Similar Threads

  1. Using decimal points in text 1.2.3
    By dichotomous2013 in forum Access
    Replies: 3
    Last Post: 01-30-2013, 06:49 PM
  2. Replies: 3
    Last Post: 12-22-2012, 05:33 PM
  3. Replies: 0
    Last Post: 10-22-2012, 02:45 PM
  4. Include Text in text box with the field
    By TinaCa in forum Reports
    Replies: 2
    Last Post: 10-05-2011, 01:42 PM
  5. Replies: 10
    Last Post: 12-11-2010, 11:01 PM

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