Information on subforms...PLEASE HELP!

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

Guest

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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top