I found the following code from one of the replies in this website. I just want the "RecordCount" to be dynamically changed according to my query value. Please let me know if this is possible.
Private Sub Form_Current()
If Me.NewRecord = True And Me.RecordsetClone.RecordCount = 5 Then
MsgBox "You have reached 5 records", vbCritical, "Limit Reached"
Me.Form.AllowAdditions = False
Else
Me.Form.AllowAdditions = True
End If
End Sub