Limit Number of Records

A

Allen Browne

Use the BeforeInsert event procedure of your subform.
Cancel the event if there are already too many records.

If this is important, you might want to DCount() the relevant records in the
subform's table rather than just read Me.RecordsetClone.RecordCount.
 
A

Arvin Meyer [MVP]

Pookey said:
How do you limit the number of records you have in a subform?

Try using the recordcount property of the subform's
recordset in the subform's Current event.

For 5 records you would do something like:

Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone

If rst.RecordCount >= 5 Then
Me.DefaultEditing = 4
Else
Me.DefaultEditing = 2
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

Top