Validation Rule -> No Quotes

J

Jochem Davids

Hi all,

Is it possible to add a validation rule to a textbox, which doesn't allow
any quotes (")?

Thanks,
Jochem
 
J

Jochem Davids

Dear Allen,

Thanks for your suggestion, it works great for a double quote " . Is it also
possible to make a validation rule which doen't allow double " and single '
quotes?

Thanks in advance, you guys are a great help in our project!!!

Jochem
 
O

Ofer Cohen

Hi Davids
On the KeyPress event of the text box, you can write the code

If KeyAscii = 34 Then
KeyAscii = 0 ' wont let the user enter ""
End If

In the If statement you can add a message box, if you want to inform the user
 
O

Ofer Cohen

Using the method I suggested, you can write
If KeyAscii = 34 Or KeyAscii = 39 Then
KeyAscii = 0 ' wont let the user enter ""
End If
 
A

Allen Browne

You can extend the validation rule by putting the bad characters in square
brackets:
Not Like "*[""']*"
 
J

Jochem Davids

Thanks both you guys, I used both the suggestions in our tool.
As said before, you guys are a real great help in our project!!

Have a great day,
Jochem
 
Top