Form number field decimals based on a second field
Posted on 2014-07-29
An expert helped me a while back with this topic but for some reason it is not working as I thought it was.
I have two fields on a form. The first one is named "txtC_SIG_FIG" and is a number field and the data entered into this field is always a whole number with no decimals. The 2nd one is named "txtC_MIN". When a number is entered into the 2nd field I want it to carry out to the number of decimals entered in the 1st field.
So, for example, if txtC_SIG_FIG is 3, and if I enter 1.23412 in the 2nd field, I want the result in the 2nd field to display as 1.234
But if the value in txtC_SIG_FIG is 4, and if I enter 1.23412 in the 2nd field, I want the result in the 2nd field to display as 1.2341
Note: The properties of the 2nd field in the table and on the form is Standard, auto decimals.
The current code which is not working is:
Me.txtC_MIN = Format([txtC_MIN], "0." & Right(10 ^ [txtC_SIG_FIG], Len(10 ^ [txtC_SIG_FIG]) - 1))