Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Round Up Result of Control

Status
Not open for further replies.

Drenda

Programmer
Sep 1, 2007
85
GB
Can anyone help

I have a control called Total Cost in the currency format which is set to equal a value based on a mathemeatical formula set by a macro and would like to round the result up to two decimal places as I suspect that the result is longer than 2 decimal places even though they are not shown. I have tried looking at the round function can can only see explanation regarding numbers. When inserting the control name in the round function it doesn't seem to work. I am trying the following

Round([Total Cost],1)
 
Assuming total cost is a text box, you must convert its value from text to something numeric. Instead of
[Total Cost], try CCur[Total Cost]) or CDec([Total Cost]).

When everything is coming your way, you're in the wrong lane.
 
Thanks

the text box is set to currency format so already is numeric. I have set decimal places to 2 and auto but to no avail. For example when I use a MsgBox to show the result it can be something like £23.9016
 
the text box is set to currency format
A text box ALWAYS contains text. You set the FORMAT property - how the text is displayed.

When everything is coming your way, you're in the wrong lane.
 
Thanks for my other thread - unfortunately it didn't answer my questions as the original thread was eventually discovered to be a number issue that was automatically rounding down when I did not want it to. Oce changed to currency this corrected itself. With this problem I already have a currency format that is not roundin down to two decimal places so I see 2 decimal places in the control but the result could be 3 or 4 decimal places.E.g. £23.6091

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top