Extracting the displayed value from a textbox (1 Viewer)

fat controller

Slightly round the bend..
Local time
Today, 14:42
Joined
Apr 14, 2011
Messages
758
I have a text box which is calculates an individual's average number of accidents per year (Total Accidents/Years of Service) - I have this rounded to two decimal places. That text box will be hidden, but the information from it will form part of a text string that is visible.

Some people, who have been employed since God was a boy, have very low accident rates which seems to be chucking it a bit of a curve ball. I have one gu who has an average of 0.09 accidents per year, but in the text string this is showing up as 9.09090909090909E-02

If I make the original textbox visible, it is showing 0.09 - is there a way to extract the displayed value, rather than the calculated value?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:42
Joined
May 7, 2009
Messages
19,169
Use Format() function:


Me.lbl.Caption=Format(Me.txtBox, "#,##0.00")
 

isladogs

MVP / VIP
Local time
Today, 14:42
Joined
Jan 14, 2017
Messages
18,186
Also you can change the textbox so it has a fixed format with e.g. 2 decimal places
 

fat controller

Slightly round the bend..
Local time
Today, 14:42
Joined
Apr 14, 2011
Messages
758
Thank you both - working perfectly how. I did have the text box formatted to two decimal places, fixed, and that was working in terms of the display - - however, when I referenced that textbox in a text string, it was coming up with the weird numbers for those that were very low.
 

fat controller

Slightly round the bend..
Local time
Today, 14:42
Joined
Apr 14, 2011
Messages
758
Access..... helpful......... Hmmmmmmmm.........

Not often those two words are in the same sentence! :D
 

Users who are viewing this thread

Top Bottom