S
scott04
Hi I am using the code below and it works fine if i am editing an existing
record. My problem is if i create a new record then it ignores this code.
Where else does this code belong so i don't have a problem? Thanks
Private Sub case_no_BeforeUpdate(Cancel As Integer)
Dim strMsg As String
If IsNull(Me.Case_No) Or (Me.Case_No = Me.Case_No.OldValue) Then
Else
If Not IsNull(DLookup("ID", "tblLawsuitTracking", "ID = " & Me.ID))
Then
Cancel = True
strMsg = "Case number already exists" & vbCrLf & _
"Please either edit existing record, re-enter a different
case number, or press Esc to undo."
MsgBox strMsg, vbExclamation, "Duplicate value!"
End If
End If
End Sub
record. My problem is if i create a new record then it ignores this code.
Where else does this code belong so i don't have a problem? Thanks
Private Sub case_no_BeforeUpdate(Cancel As Integer)
Dim strMsg As String
If IsNull(Me.Case_No) Or (Me.Case_No = Me.Case_No.OldValue) Then
Else
If Not IsNull(DLookup("ID", "tblLawsuitTracking", "ID = " & Me.ID))
Then
Cancel = True
strMsg = "Case number already exists" & vbCrLf & _
"Please either edit existing record, re-enter a different
case number, or press Esc to undo."
MsgBox strMsg, vbExclamation, "Duplicate value!"
End If
End If
End Sub