Identifying duplicate records logged within past 30 days

J

Joy

I have this code to idnetify when possible duplicate
records are being entered. As you can see the code looks
for a match on these two fields:

[InsPolicyOrAcctNo] and "[CaseTypeID]

My situatjion is this, I need to add to the criteria to
look back at only those records received in the past 30
days. I have a field [DateReceived] and I'm just not sure
where I would put the criteria of >Date()-30. Any
suggestoins on how I could accomplish this/ Thank you

Private Sub InsPolicyOrAcctNo_AfterUpdate()

Dim strExistingCaseID As String

strExistingCaseID = Nz(DLookup
("[CaseID]", "tblCases", "[CaseTypeID]=" & Me.CaseTypeID
& " AND [InsPolicyOrAcctNo]='" & Me.InsPolicyOrAcctNo
& "'"), "")

If strExistingCaseID <> "" Then
MsgBox "A possible duplicate case was created on "
& DLookup("[DateReceived]", "tblCases", "[CaseID]='" &
strExistingCaseID & "'") & "." & vbCrLf & vbCrLf & "Please
refer to this case ID: " & strExistingCaseID, vbOKOnly +
vbExclamation, "Warning"
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top