I have a main form which contains a subform for entering some information. I only want the user to be able to enter four records at time in this subform. Is there a way for me to limit how many records can be entered in the subform?
On the BeforeInsert Event for the subform put a check that Cancels the Event if the number of records exceeds 4 (or any other number).
You'll have to write some code (or call a query) that counts the number of records in the underlying recordsource for the subform, but that's a piece of cake too. Probably the simplest way is to use a RecordsetClone for the subform and utilise its RecordCount property.
Actually, you could also play around with the forms AllowAdditions property. Perhaps set it to False on the BeforeInsert or AfterInsert Event for the subform if the number of records is 4, otherwise set it to True.
Hope that helps.
Your experience level is not an issue. We can help you. We just need more detail on your operations here.
For instance:
[ol][li]What criteria (if any) determines turning full editing back on?[/li]
[li]What criteria determines the next group of four records?[/li]
[li]What is the purpose of groups of four or four only?[/li][/ol]
Chances are we can suggest better implementation of what your trying to accomplish. ;-)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.