Truncating after the Decimal

J

jegrau

Is there any way to set up a field so you only get two decimal places either
by coding or properties?

I have a field that converts hours to work months.

My Code: WorkMonthsUsedTL = HoursUsedTL / 174

Form entry HoursUsedTL 8

Result: 4.59770114942529E-02


--
John E. Grau
IT Specialist
Bureau of Land Managment
Miles City Field Office
Miles City MT 59301
[email protected]
 
J

John W. Vinson

Is there any way to set up a field so you only get two decimal places either
by coding or properties?

I have a field that converts hours to work months.

My Code: WorkMonthsUsedTL = HoursUsedTL / 174

Form entry HoursUsedTL 8

Result: 4.59770114942529E-02

I'd suggest explicitly rounding in the code:

WorkMonthsUsedTL = Round(HoursUsedTL / 174, 2)

Alternatively you could Dim WorkMonthsUsedTL as a Decimal, specifying two
decimal places.
 
Top