G
Guest
Hi
I have an Access 97 db. I'm trying to validate that data entered into a
bound field does not contain any spaces. The field in the underlying table
has Required set to Yes, Zero Length set to No and the field is indexed with
duplicates allowed.
Here's the code, but it keeps giving me a 2115 error. Can anyone see what
the problem is?
Private Sub TxtBarCode_BeforeUpdate(Cancel As Integer)
'^^^Check for spaces in TxtBarCode
If InStr([TxtBarCode], " ") <> 0 Then
MsgBox "The Bar Code can't contain spaces." & vbCrLf & "Please enter it
without spaces.", vbExclamation, "Spaces found"
Cancel = True
Me!TxtBarCode.Undo
Exit Sub
End If
End Sub
I have an Access 97 db. I'm trying to validate that data entered into a
bound field does not contain any spaces. The field in the underlying table
has Required set to Yes, Zero Length set to No and the field is indexed with
duplicates allowed.
Here's the code, but it keeps giving me a 2115 error. Can anyone see what
the problem is?
Private Sub TxtBarCode_BeforeUpdate(Cancel As Integer)
'^^^Check for spaces in TxtBarCode
If InStr([TxtBarCode], " ") <> 0 Then
MsgBox "The Bar Code can't contain spaces." & vbCrLf & "Please enter it
without spaces.", vbExclamation, "Spaces found"
Cancel = True
Me!TxtBarCode.Undo
Exit Sub
End If
End Sub