decimals and zeros

K

Kim Smith

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


example:


Change 3.40 to 3.4 but change 3.0 to 3


Just by setting decimal places to auto in text box properties I get all (.5)
to work its just when you do numbers like 3.2 and 3.6 that you get 3.20 and
3.60.

To recap if I have a row of numbers I would like:

3.2 -> to read as 3.2 not 3.20

3 -> to read as 3 not 3.0

2.2 -> to read as 2.2 not 2.20

4.5 -> to read as 4.5 not 4.50

Thanks
 
A

Amit

Kim Smith said:
My question is that I have set my text box in a report to just give me one
decimal,
but how do I set it to drop the decimal when the value is 0.


example:


Change 3.40 to 3.4 but change 3.0 to 3


Just by setting decimal places to auto in text box properties I get all (.5)
to work its just when you do numbers like 3.2 and 3.6 that you get 3.20 and
3.60.

To recap if I have a row of numbers I would like:

3.2 -> to read as 3.2 not 3.20

3 -> to read as 3 not 3.0

2.2 -> to read as 2.2 not 2.20

4.5 -> to read as 4.5 not 4.50

Hi Kim,
Here's ONE way of doing this.

Try putting the following in the Format of the textbox control on your report:
=IIf(Int([txtNum])=([txtNum]),Format([txtNum],"0"),Format([txtNum],"0.0"))

where [txtNum] is the name of the field that has the number values. Replace
[txtNum] with the name of the field on your report.

Basically, the above IIf condition compares the INT(num) with (num) and
formats it according to the result being true/false.

Hope this helps.

-Amit
 

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
Auto fill column with sequential numbers with decimals 2
Row Count... 4
countif 9
Which Way To Go 0
RE : filtering problem 2
Trailing zeros 5
Math Does Not Add Up 2

Top