Validation Rule -> No Quotes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,

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

Thanks,
Jochem
 
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
 
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
 
Using the method I suggested, you can write
If KeyAscii = 34 Or KeyAscii = 39 Then
KeyAscii = 0 ' wont let the user enter ""
End If
 
You can extend the validation rule by putting the bad characters in square
brackets:
Not Like "*[""']*"
 
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
 
Ofer said:
Using the method I suggested, you can write
If KeyAscii = 34 Or KeyAscii = 39 Then
KeyAscii = 0 ' wont let the user enter ""
End If

Does your code prevent a user from pasting in text containing quotes
from the clipboard?

As ever, a validation rule is required in the database to stop bad data
from getting in.

Jamie.

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top