How to drop decimal when value is zero

  • Thread starter Thread starter ksmith
  • Start date Start date
K

ksmith

My question is that I have set my field to just give me one decimal,
but how do I set it to drop the decimal when the value is 0.

example:

Keep 3.4 as 3.4 but change 3.0 to 0

Thanks
 
Do you mean you want to display the decimal in a form text box or on a
report?
If you want to do this for a field that users can update, the zero portion
will have
to be allowed and displayed. However, for the sake of a report, you might
be
able to convert the number to a string, check for zeros on the right and
drop them.
Something like this ....

IIF(Right(CStr([MyVal]),2) = ".0",Left(CStr([MyVal], Len(CStr([MyVal]))-2),
CStr([MyVal]))

This is clumsy, probably slow and not updateable when placed in a query, but
for
a report, it could work.
 

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

Similar Threads

How to drop decimal when value is zero 4
decimals and zeros 1
Imported numbers missing decimals 5
Decimal Places 1
decimals 6
Display decimal value in textbox 5
Currency Decimals 5
Decimal Points 3

Back
Top