Decimal place problem

StuartDwight

Registered User.
Local time
Today, 16:19
Joined
Mar 22, 2001
Messages
12
I have a field on my table set to Double with 1 Decimal place. I want to limit the input on this field so that the user can only enter either .0 or .5 after the decimal point. Has anyone any ideas.
Regards,
Stuart.
 
Test it in the BeforeUpdate event of the control and alert the user when it does not comply with your criteria. You can either change the input and continue, leave it alone or clear it with Me.ControlName.UnDo and set Cancel = True to hold the user in the control.
 
It's the code bit to work if it complies with my criteria I'm struggling with.
 
Stuart,

Use --> Right(CStr(Me.YourNumber), 2) to view it as a string

Or

Use Me.YourNumber * 100 and use MOD 50

hth,
Wayne
 
I was having a problem with whole numbers like 1.0, it seemed to strip of the .0 and was coming back as 1 which is allowed, and was failing my check.
The * 100 MOD 50 worked a treat, add the "undo" and "cancel" and the validation worksperfetly.
Thanks Guys.
 
Stuart,

You could also have used the Right of the Format function with a format
something like "9999.0".

Glad you got it though.

See ya,
Wayne
 

Users who are viewing this thread

Back
Top Bottom