Limiting rows

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I built a table [Discrepancies] and have it on a tabbed form. What I am
trying to do is limit the total number or rows to 10 for each [ID]. Is this
possible? The end result is to have to form and report look like a predefined
form that I have to work from and the total number of rows on the form are
10. (Less deviation less likely for a user to mess it up)
 
Add a footer to the subform. It doesn't need to be visible on the main form.
Add a control to the footer. Give the control some meaningful name such as
RecCount. The control source should be:
=Count(*)
In the BeforeInsert event of the subform, check the RecCount.

Code:
If Me.RecCount > 9 Then
MsgBox "No more records may be added", vbOKOnly
Cancel = True
Me.Undo
End If
 
Back
Top