S
Sandy Burgess
I have a table called Patient Data that contains Social Security Numbers. –
the field is called SSN I do not want duplicate SSN’s in the database,
On my input form, I have the following event procedure on the Before Update
line
Private Sub textSSN_BeforeUpdate(Cancel As Integer)
If SSN = DLookup("SSN", "Patient Data", "[SSN] = '" & textSSN & "'") Then
MsgBox "SSN exists. Verify SSN."
Cancel = True
Me.textSSN.SelStart = 0
Me.textSSN.SelLength = Len(Me.textSSN)
End If
End Sub
The message box with “SSN exists. Verify SSN†comes up. So far so good.
Then when I click ok, I get an Access Popup that states “The value in the
field or record violates the validation rule for the record or field ………â€
How can I get rid this second popup? This message will confuse the casual
user. Thanks for your help.
Sandy
the field is called SSN I do not want duplicate SSN’s in the database,
On my input form, I have the following event procedure on the Before Update
line
Private Sub textSSN_BeforeUpdate(Cancel As Integer)
If SSN = DLookup("SSN", "Patient Data", "[SSN] = '" & textSSN & "'") Then
MsgBox "SSN exists. Verify SSN."
Cancel = True
Me.textSSN.SelStart = 0
Me.textSSN.SelLength = Len(Me.textSSN)
End If
End Sub
The message box with “SSN exists. Verify SSN†comes up. So far so good.
Then when I click ok, I get an Access Popup that states “The value in the
field or record violates the validation rule for the record or field ………â€
How can I get rid this second popup? This message will confuse the casual
user. Thanks for your help.
Sandy