Information on subforms...PLEASE HELP!

A

ac512

Hello

Is there a way, that I can limit a subform to 3 records?

I am using Access 2002, and have a form which contains a subform.
The subform's default view is set to 'Continuous Forms', as the record in
the main form can have more than 1 associated record in the subform.

I do not want a user to be able to input more than 3 records in the subform.
Hoping someone may be able to help
Thanking you in advance

AC
 
P

Pat Hartman\(MVP\)

Add a footer to the subform.
Add a control to the footer with a control source of:
=Count(*)

In the BeforeInsert event of the subform, check the count field. If it is >
2, cancel the BeforeInsert event and give the user a message.

If Me.txtCount > 2 Then
MsgBox "No more records allowed.", vbOKOnly
Cancel = True
End If
 
Top