Hi,
Is it possible to add DLookUp to check for duplicates before adding new records? In my case, the true duplicate record will consist of both ParentCIN & FeeCodeID fields.
I only want the code to insert new fees if they don't exist, if they already have one exist (matching both parentCIN & FeeCodeID), then do not add those. What will be the best method to handle these "if", case statement?
Private Sub CmdAddStandardFees_Click()
On Error GoTo Err_CmdAddStandardFees_Click
Dim sSQL As String
If Me.Dirty Then Me.Dirty = False
sSQL = "INSERT INTO Tbl_CustomerFeeSchedule (FeeCodeID, ParentCIN ) " _
& "SELECT tbl_FeeTable.FeeCodeID," & [Forms]![frm_ListOfParents]![ParentCIN] & " AS ParentCIN " _
& "FROM tbl_FeeTable;"
Debug.Print sSQL
CurrentDb.Execute sSQL, dbFailOnError
Exit_CmdAddStandardFees_Click:
Exit Sub
Err_CmdAddStandardFees_Click:
MsgBox "Error: (" & Err.Number & ") " & Err.Description, vbCritical
Resume Exit_CmdAddStandardFees_Click
End Sub