Hello'
I have a field in which I require validation in a before update
event.
The validation code I have works fine, no problem there.
However I would like to turn off the default validation error
message...as it shows up in addition to the message I am providing.
For some reason, (SetWarnings = False) does not apply to this error...
Error: "The value in the field or record violates the validation rule
for the record or field..."
Here is my code;
Private Sub txtSample_BeforeUpdate(Cancel As Integer)
SetWarnings = False
Me.txtSample.BackColor = 16777215
Dim varReturnValue As Variant
varReturnValue = DLookup(Me!txtSample, "tblResults", "[Sample] =
" & Chr$(34) & Me! txtSample & Chr$(34))
If Not IsNull(varReturnValue) Then
MsgBox "This Sample # is already allocated, please input a
different sample number. If you would like to edit the entered sample
#, please use the data review prompts from the main menu."
Cancel = True
End If
End Sub
I assumed that SetWarnings would remove this message but it does not.
Is there another Default messages function I am unaware of?
Thanks