Good evening everyone
I am trying to use this code to restrict the user to enter only 20 records per day. But I get an error when executing.
I am trying to use this code to restrict the user to enter only 20 records per day. But I get an error when executing.
Code:
Private Sub Form_BeforeInsert(Cancel As Integer)
Dim CountOfTodaysEntries As Integer
CountOfTodaysEntries = DCount("ID", "tblMaid", "s_date = Date() AND ID = " & Me.ID)
If CountOfTodaysEntries > 20 Then
MsgBox "Max daily entries reached. Try again tomorrow."
Cancel = True
End If
End Sub