Hey guys,
I have built an awards tracker that we have 6 different people inputing awards into. With this many people involved I have written an IF Dcount( statement to try to prevent duplicate entries. I have gotten it to do ALMOST what I want, but still havent got it perfect. The following is where I am at on the code...
If DCount("*", "tblAwardsLog", "[PO #] & LastName & DateInitiated = '" & Me.[PO #] & Me.LastName & Me.DateInitiated & "'") > 0 Then
DoCmd.CancelEvent
DoCmd.OpenForm "frmRecordExists"
End If
If DCount("*", "tblAwardsLog", "LastName & Left(FirstName,3) & Recommended & DateInitiated & Nz([PO #]) = '" & Me.LastName & Left(Me.FirstName, 3) & Me.Recommended & Me.DateInitiated & Nz(Me.[PO #]) & "'") > 0 Then
DoCmd.CancelEvent
DoCmd.OpenForm "frmRecordExists"
End If
If DCount("*", "tblAwardsLog", "LastName & Left(FirstName,3) & Recommended & DateInitiated = '" & Me.LastName & Left(Me.FirstName, 3) & Me.Recommended & Me.DateInitiated & "'") > 0 Then
DoCmd.CancelEvent
DoCmd.OpenForm "frmRecordExists"
Cancel = True
End If
The problem is if I don't add a [PO #] when I first add the record, then I try to go back to add a PO # it tells me the record already exists. The fields I need checked is [LastName], [Left(FirstName, 3)], [Recommended], [DateInitiated], [PO #]