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
(e-mail address removed)
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top