I am new to ms access, I have prepared a database for a school where I want to apply duplicate entry restrictions.
I want to stop duplicate entry in same month. Type of studentID
is number while the month is linked with another table where its type is text. I have tried many options but type mismatch error occurs. The data is being entered from a form and I need to apply validation at the time of form update
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim x As Integer
x = DCount("StudentID", "tblFeeVoucherGenerate", "StudentID =" & Me.StudentID & " ")
If x > 0 Then
MsgBox "Fee Already Recorded for this month"
Me.Undo
Exit Sub
End If
DoCmd.RunCommand acCmdSaveRecord
MsgBox "Record has been Saved"
DoCmd.RunCommand acCmdRecordsGoToNew
End Sub
I want to add month condition to record a student fee once in a month.