i dim curtotal as currency but my finals output is not in currency. it gives me numbers like 12.325 or any number with three or four decimalsCode:curtotal = (((curftotal + curstotal + curbtotal) * sngtax) + (curftotal + curstotal + curbtotal))
Printable View
i dim curtotal as currency but my finals output is not in currency. it gives me numbers like 12.325 or any number with three or four decimalsCode:curtotal = (((curftotal + curstotal + curbtotal) * sngtax) + (curftotal + curstotal + curbtotal))
The currency data type allows for up to 4 digits to the right of decimal point. If you want only two, then you need to round the result.
can you show me how to round? would it be likeQuote:
Originally Posted by Logophobic
curtotal = Round(((curftotal + curstotal + curbtotal) * sngtax) + (curftotal + curstotal + curbtotal)),2
Code:Debug.Print Format(yourCurrencyVariable, "###,###.00")
Another way would be
where 2 is the number of decimal places you want.vb Code:
curtotal = FormatNumber((((curftotal + curstotal + curbtotal) * sngtax) + (curftotal + curstotal + curbtotal)),2)
BTW it's better to use [highlight=vb][/highlight] tags when posting code. Then to get around the problem with copy/paste of code formatted that way you can use the app you can download from the Copy/Paste VB Code link in my signature.
[QUOTE=MartinLiss]Another way would be
where 2 is the number of decimal places you want.vb Code:
curtotal = FormatNumber((((curftotal + curstotal + curbtotal) * sngtax) + (curftotal + curstotal + curbtotal)),2)
QUOTE]
thanks thats perfect
Thank you all
Now that we've helped you, you can help us by pulling down the Thread Tools menu and clicking the Mark Thread Resolved button which will let everyone know that you have your answer.