how to clear a validation of text box in VBA

newaccess

Registered User.
Local time
Yesterday, 19:09
Joined
Apr 6, 2011
Messages
27
Hi Experts,

I created a added data form with input text box.

I set a validation rule in there. such <1000.

However, even I remove all number in text box, but I still got validation message and much enter quality number (<1000) before closed form. I set a reset button with codes as Me.SALECODE = Null and Me.Refresh


Reset button does not work. I still got validation message when i move into other text box even there are no any number in first validation text box.

Thanks for help!
Newaccesser
 
Last edited:
did you maybe put the validation rule on the field in the table as well?
 
Hi Bob,

Table is in Oracle database with a linkedtable in access. that you means do validation rule in VBA codes. it is a idea

The filed validation works before clicked reset button
It seems that no way to broken by reset button.
Thanks
Jimmy
 
So you are putting this "validation rule" in the validation rule property of the text box? Personally I would not as you can't modify it from code unless the form is in design view first and you can't do that in the runtime. Just use the BeforeUpdate event to check the value to see if it passes or fails whatever you want it to be and then if it isn't you can use

Cancel = True
Me.YourControlName.Undo

and you can add a message box if you would like.
 

Users who are viewing this thread

Back
Top Bottom