Home Privacy Policy Feedback Link to us Site Map Forums

Access: Format a string to display as a currency value in Access 2003/XP/2000/97


Question:  In Access 2003/XP/2000/97, I'm trying to display a currency variable in a message box, but the value is not showing correctly. For example, the message box is displaying £2.5 instead of £2.50.

How can I properly display the currency value in the message box?

Answer:  You will need to use the Format function to properly display the currency value.

For example, you could use the following code to correct the display of your message box:

Sub DisplayCost()

    Dim strcost As Currency

    strcost = 2.5

    'Display the total cost
    MsgBox "The Total Cost for this Audit is " & Format(strcost, "Currency")

End Sub


This would properly display your 2.5 stored in the strcost variable as £2.50.

Your message box should now display as: