RitaMoloney
Registered User.
- Local time
- Today, 07:02
- Joined
- May 6, 2004
- Messages
- 50
Hi,
I have a form that is used to enter employee information. On the text box for entering employee name I want to prevent the user from entering certain characters such as ' . If the user enters an employee's name like Barry O'Connor a message should appears saying
Please do not use the following characters when entering a name: ' .
At the moment this works if you only enter ' in the text box but if you enter text with it i.e. Barry O'Connor , it does not work.
This is the code I have entered in the before update event of EmployeeName text box.
Private Sub EmployeeName_BeforeUpdate(Cancel As Integer)
If Me.EmployeeName.Value = " ' " Then
MsgBox " Please do not use following characters when entering a name; ' ", vbExclamation
Me.EmployeeName.Undo
Cancel = True
End If
End Sub
Has anyone any idea how to solve this problem.
Thanks in advance for any help.
I have a form that is used to enter employee information. On the text box for entering employee name I want to prevent the user from entering certain characters such as ' . If the user enters an employee's name like Barry O'Connor a message should appears saying
Please do not use the following characters when entering a name: ' .
At the moment this works if you only enter ' in the text box but if you enter text with it i.e. Barry O'Connor , it does not work.
This is the code I have entered in the before update event of EmployeeName text box.
Private Sub EmployeeName_BeforeUpdate(Cancel As Integer)
If Me.EmployeeName.Value = " ' " Then
MsgBox " Please do not use following characters when entering a name; ' ", vbExclamation
Me.EmployeeName.Undo
Cancel = True
End If
End Sub
Has anyone any idea how to solve this problem.
Thanks in advance for any help.