Limit Number of Records

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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
 
Back
Top