B
BillyRogers
What event should be used to run code to validate a textbox?
I had this in the OnEnter event and it ran the code everytime the form was
opened before the user had a chance to enter anything.
Dim re, s
Set re = New RegExp
re.Global = True
s = txtEmailAddress.Text
re.Pattern =
"^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$"
If Not re.Test(s) Then
MsgBox "Email address is NOT valid."
End If
--
Billy Rogers
Dallas,TX
Currently Using SQL Server 2000, Office 2000 and Office 2003
I had this in the OnEnter event and it ran the code everytime the form was
opened before the user had a chance to enter anything.
Dim re, s
Set re = New RegExp
re.Global = True
s = txtEmailAddress.Text
re.Pattern =
"^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$"
If Not re.Test(s) Then
MsgBox "Email address is NOT valid."
End If
--
Billy Rogers
Dallas,TX
Currently Using SQL Server 2000, Office 2000 and Office 2003