I have a table "tbdetails" where students' details are kept. Put simply, I want to limit the table to only hold 10 records max. My form for the table "frmDetails" has the following OnCurrent Event but it did not work:
Private Sub Form_Current()
Forms(Detail).MaxRecords = 10
End Sub
I looked online and found that but I could just so easily insert 11 and 12 records. Any answer is welcome, VBA is not required (if it is possible to go without it ) Can this be done simply from the properties menu or something?
EDIT:
Now when I saved I get
Runtime error 438: Object Doesn't Support this Property or Method
So there is definitely something wrong here
Private Sub Form_Current()
Me.AllowAdditions = (Nz(DCount("[IDFieldName]","[TableName]",""),0)<10)
End Sub
Based on comments is seems this is enough:
Me.AllowAdditions = (DCount("[IDFieldName]","[TableName]")<10)