I assumed that SignificantDigits.Value was the hidden field telling it

how many decimal places to show.

What I posted would calculate the results for a field.

Int([UpperTolerance]) & "." & Left([UpperTolerance] -

Int([UpperTolerance]) & "000", SignificantDigits.Value)

Int([UpperTolerance]) gives you the integer portion of the value.

& "." & adds a decimal to the integer.

([UpperTolerance] - Int([UpperTolerance]) subtracts the integer from the

whole number leaving the decimal.

& "000", adds zeros to the string.

SignificantDigits.Value) controls how much of the left side of the

decimal value and zeros to display in the results.

I do not know how to place it in code.

--

Build a little, test a little.

JohnE said:

Thanks for the reply. I gave your suggestion a try and got 'Invalid Use of

Null" error message. I placed the line below into the UpperTolerance

AfterUpdate event. Or would it be better in the hidden field

(SignificantDigits) event of some type?

SignificantDigits.Value = Int([UpperTolerance]) & "." &

Left([UpperTolerance] - Int([UpperTolerance]) & "000",

SignificantDigits.Value)

Thanks.

John

KARL DEWEY said:

The Nz function returns a 'number' and numbers do not have leading zeros or

trailing decimal zeros. A text field can display both leading and trailing

zeros.

UNTESTED - But I think you can use the hidden field value like this --

Int([UpperTolerance]) & "." & Left([UpperTolerance] -

Int([UpperTolerance]) & "000", SignificantDigits.Value)

--

Build a little, test a little.

:

I have an engineering tolerance test result that needs to be kept as a

decimal but the field is dropping the last zero entered. An example is if

the user types in 0.010, the last 0 is getting dropped. That 0 must be

there. (In engineering tolerance testing of med devices there is a

difference between .010 and .01.)

There is another field (hidden) that is to store the number of places after

the decimal point. So in the example above it should have 3 in the hidden

textbox. The code below is in the AfterUpdate event of the tolerance field

the user would enter the 0.010 but the hidden field will show 2 instead of 3.

If the user typed in 0.001, the hidden field shows 3, which is correct.

Mainly, if the last digit typed is 0, then it drops off and the count in the

hidden field is short by one.

Dim decCount As Long

decCount = Nz(Len(Mid([UpperTolerance], InStr([UpperTolerance], ".") + 1)), 0)

SignificantDigits.Value = decCount

Am I missing something in the code above that would count the ending 0? I

tried this in the BeforeUpdate of the tolerance field and got the same

result. I need help on this.

Thanks.

John