H
Herschel Elkins
I am trying to validate the data entered into a text box
on a form. I want to allow the following data to be
entered into the field: The word UNKNOWN or the word
PATERNITY or the word FOSTERCARE or a 10 digit number
beginning with the number 7.
Here's what I have so far:
Private Sub SETSCASE_BeforeUpdate(Cancel As Integer)
Dim str As String
If Not IsNull(Me!SETSCASE) Then
str = Me!SETSCASE
If str <> "UNKNOWN" Or str <> "PATERNITY" Or
str <> "FOSTERCARE" Or str <> "7#########" Then
MsgBox "You must enter a 10 digit number beginning
with 7 or UNKNOWN or PATERNITY or FOSTERCARE.",
vbExclamation
Cancel = True
End If
End If
End Sub
The problem is that this code will not allow any value to
be entered.
Any help would be appreciated.
Thanks
on a form. I want to allow the following data to be
entered into the field: The word UNKNOWN or the word
PATERNITY or the word FOSTERCARE or a 10 digit number
beginning with the number 7.
Here's what I have so far:
Private Sub SETSCASE_BeforeUpdate(Cancel As Integer)
Dim str As String
If Not IsNull(Me!SETSCASE) Then
str = Me!SETSCASE
If str <> "UNKNOWN" Or str <> "PATERNITY" Or
str <> "FOSTERCARE" Or str <> "7#########" Then
MsgBox "You must enter a 10 digit number beginning
with 7 or UNKNOWN or PATERNITY or FOSTERCARE.",
vbExclamation
Cancel = True
End If
End If
End Sub
The problem is that this code will not allow any value to
be entered.
Any help would be appreciated.
Thanks