Hi,
I have been trying to find a way around this little problem for some time now and am almost there...
I have a bound text box [TheirClaimNumber] and if a user enters in a duplicate entry I have this code so far which works only to a certain degree.
The form Duplicates recordsource is a duplicate query based on the table in question.
My problem is if the user is entering the very first duplicate my Dlookup triggers the MSGBOX but when I click Yes the form comes up blank.
Help please!
Here is what I have so far...please be kind.
Private Sub TheirClaimNumber_BeforeUpdate(Cancel As Integer)
If (Not IsNull(DLookup("[TheirClaimNumber]", "tblClaimants", _
"[TheirClaimNumber] ='" & Me!TheirClaimNumber & "'")) Then
If MsgBox("Warning claim number has already been entered in the database" _
& vbNewLine & "Click Yes to View the Existing Claim" & vbNewLine & _
"Click No to Add this as a New Claim", vbYesNo, "Verify Duplicate Claim" = vbYes Then
DoCmd.OpenForm "Duplicates", acNormal, , , acFormReadOnly
End If
End If
End Sub
Peter Remember- It's nice to be important,
but it's important to be nice
I have been trying to find a way around this little problem for some time now and am almost there...
I have a bound text box [TheirClaimNumber] and if a user enters in a duplicate entry I have this code so far which works only to a certain degree.
The form Duplicates recordsource is a duplicate query based on the table in question.
My problem is if the user is entering the very first duplicate my Dlookup triggers the MSGBOX but when I click Yes the form comes up blank.
Help please!
Here is what I have so far...please be kind.
Private Sub TheirClaimNumber_BeforeUpdate(Cancel As Integer)
If (Not IsNull(DLookup("[TheirClaimNumber]", "tblClaimants", _
"[TheirClaimNumber] ='" & Me!TheirClaimNumber & "'")) Then
If MsgBox("Warning claim number has already been entered in the database" _
& vbNewLine & "Click Yes to View the Existing Claim" & vbNewLine & _
"Click No to Add this as a New Claim", vbYesNo, "Verify Duplicate Claim" = vbYes Then
DoCmd.OpenForm "Duplicates", acNormal, , , acFormReadOnly
End If
End If
End Sub
Peter Remember- It's nice to be important,
but it's important to be nice