Controlling Decimal Precision at Time of Data Entry?

T

TryingToLearnVBA

Greetings,

I have created a form to collect two numeric values for "TestStartTime" and
"TestFinishTime". The precision for both of these values is one space to the
right of the decimal (tenths) place.

What I would like to know is; How (OR Where?) can I perform a Round([""],1)
operation on the form at the time of data entry, to prevent data with a
higher precision (ie. entered incorrectly) from making it through my form
controls?

In the DB table, both of these fields are set up as number 'data types' and
single 'subtypes', with format = 'fixed' and decimal places = '1'. Also, in
the form design, format = 'fixed' and decimal places = '1'. This has not
solved my problem; Only altered the way that the value is displayed...

Any suggestions are always appreciated.
 
R

Rick Brandt

TryingToLearnVBA said:
Greetings,

I have created a form to collect two numeric values for
"TestStartTime" and "TestFinishTime". The precision for both of
these values is one space to the right of the decimal (tenths) place.

What I would like to know is; How (OR Where?) can I perform a
Round([""],1) operation on the form at the time of data entry, to
prevent data with a higher precision (ie. entered incorrectly) from
making it through my form controls?

In the DB table, both of these fields are set up as number 'data
types' and single 'subtypes', with format = 'fixed' and decimal
places = '1'. Also, in the form design, format = 'fixed' and decimal
places = '1'. This has not solved my problem; Only altered the way
that the value is displayed...

Any suggestions are always appreciated.

Use an InputMask.
 
M

Marshall Barton

TryingToLearnVBA said:
I have created a form to collect two numeric values for "TestStartTime" and
"TestFinishTime". The precision for both of these values is one space to the
right of the decimal (tenths) place.

What I would like to know is; How (OR Where?) can I perform a Round([""],1)
operation on the form at the time of data entry, to prevent data with a
higher precision (ie. entered incorrectly) from making it through my form
controls?

In the DB table, both of these fields are set up as number 'data types' and
single 'subtypes', with format = 'fixed' and decimal places = '1'. Also, in
the form design, format = 'fixed' and decimal places = '1'. This has not
solved my problem; Only altered the way that the value is displayed...


You can use each text box's AfterUpdate event with code
like:
Me.TestStartTime = Round(Me.TestStartTime, 1)
 
T

TryingToLearnVBA

I thank you both, Rick and Marshall, for your suggestions.

I had some trouble getting the Input Mask wizard to run on a 'number' field
type, so I chose to use Marshall's code to perform the rounding.

I copied the code directly into the fields AfterUpdate event. It does
exactly what I wanted it to do. The only thing I had to modify was the field
names.

Thanks for the help...
--
Thank You.


Marshall Barton said:
TryingToLearnVBA said:
I have created a form to collect two numeric values for "TestStartTime" and
"TestFinishTime". The precision for both of these values is one space to the
right of the decimal (tenths) place.

What I would like to know is; How (OR Where?) can I perform a Round([""],1)
operation on the form at the time of data entry, to prevent data with a
higher precision (ie. entered incorrectly) from making it through my form
controls?

In the DB table, both of these fields are set up as number 'data types' and
single 'subtypes', with format = 'fixed' and decimal places = '1'. Also, in
the form design, format = 'fixed' and decimal places = '1'. This has not
solved my problem; Only altered the way that the value is displayed...


You can use each text box's AfterUpdate event with code
like:
Me.TestStartTime = Round(Me.TestStartTime, 1)
 

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