Before updating a form I want to prevent duplicate records from being created by cross referencing the associate name on reporting month entered in the form to the master table. The code I'm using below keep on telling me that my DCount function does not work. I'm not sure where the error is but I'm sure it's pretty simple... Please Help
Private Sub Reporting_Month_BeforeUpdate(Cancel As Integer)
Dim AssocName As Integer
Dim RptMonth As Integer
AssocName = DCount("*", "Master Scores Table", "Associate Name = '" & Me.Associate_Name & "'")
RptMonth = DCount("*", "Master Score Table", "Reporting Month = '" & Me.Reporting_Month & "'")
If (AssocName >= 1 And RptMonth >= 1) Then
MsgBox "This associate already has a record for this month"
Exit Sub
End If
End Sub