Limiting Field Input to 1/8 Increments

T

Tom Perot

I have a need to limit the input that a person enters for measuring a deer's
antlers to 1/8 increments. How can I best implement so that when a person
enters a measurement, the field recalcs/rounds to nearest 1/8th or requires
the person to only enter an valid amount such as 5.125, 5.250, etc.

Thanks for your expertise in advance.
 
A

Al Campagna

Tom,
That's an interesting question...

How about a combo (cboInches) with all possible full Inch values, and
a second combo, with all possible parts of an inch... based on a tblEighths
tblEighths
8thValue MeasuredValue
.0 1/32
.0 1/16
.125 3/32
.125 1/8
.125 5/32
.125 3/16
.250 7/32
.250 1/8 etc....
Hide Column1 and bind it to your 1/8" field. That will allow the user
to
select using the MeasuredValue, but really save the appropriate 1/8 decimal
value.
If you don't want to deal with the decimal values, you could substitute
1/8
text increments in tblEights... but I would suggest always using the decimal
for
your purposes, and then translate those values back to 1/8s only when
interfacing
with users.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
P

Paul Shapiro

You could make the data two columns, one for antler inches and a second
column for additional eighths of an inch (with a validation rule that the
data must be between 0 and 7), but I wouldn't do it that way. You can write
a field validation rule in the table that rejects any non-conforming data,
and do the same thing on the data entry form. If you're using a floating
point data type, your rule has to allow for a small round-off error.
 

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