Conditional Formatting and Validation Rule
On Wed, 10 Feb 2010 10:23:02 -0800, oldblindpew
wrote:
Then you're doing validation incorrectly. Say I have a textbox named
myText and I want the user to enter a number greater than 10. I could
write this in myText_BeforeUpdate event:
if Me.myText = 10 then
msgbox "Yo! Greater than ten!", vbExclamation
Cancel = True
end if
The "Cancel=True" line is essential, and stops the user from doing
anything else until the requirement is satisfied, or she hits Esc to
cancel the record.
Note: in this example I am not using ValidationRule, ValidationText
either at the control level or the table field. Years go by that I
don't use these properties.
-Tom.
Microsoft Access MVP
Hopefully the user
will get the hint and correct his mistake, but this is not best practice
because it only provides a warning, rather than a prohibition, of invalid
data.
|