Input Mask Error

George Too

Registered User.
Local time
Today, 17:24
Joined
Aug 12, 2002
Messages
198
Hi All,
This might be easy but I can't seem to get it working. I want to force users to use decimal point in a field where units of measure are entered eg. 12.5647, 9.5478, etc My input mask for that field is 00\.0000;1;_ but it does not save the decimal point. 12.5647 will be written as 125647 and that drives us nuts changing the data afterwards. What am I doing wrong? Table field has been set to text however it doesn't work with changing the field to number either.

Any ideas?
Thanks.
 
Never mind I messed up. You already had the literal designator in there
 
Last edited:
definitely keep it as a number. you dont want to be parsing text, as access will do that

now

123 is a valid number

as is 1.23

--------
if you want to reject the former, then in the controls beforeupdate event you need to examine it and reject it there, if it is out of range, or if it does not have a decimal part.

eg

Code:
sub myfield_before_update_click (cancel as integer)

{myfield is your value}
{clng(myfield) rounds it to a long integer}
if myfield - clng(myfield) <>0 then
    {hence if they are not the same}
    msgbox("You must enter a decimal value")
    {this refuses the input}
    cancel = vbcancel
end if
exit sub
 
Thanks Bob and gemma, I solved it with a combination of mask and code. Changed the mask to "00&0000;1;_" forcing the user to type a decimal point in the specified position and then test with code similar to gemma's.

Thanks,
George
 

Users who are viewing this thread

Back
Top Bottom