I want to limit the number of records in my subform to 5. I've tried different codes found on this forum:
Form_Current
If RecordsetClone.RecordCount >= 5 Then
Me.AllowAdditions = False
End If
End Sub
Or:
Private sub Form_BeforeInsert (Cancel as Integer)
If Me.recordcount >= 5 Then
Cancel = true
Me.Undo
End If
End sub
The result has been that when I add a new record to the Main Form, I can't add any records to the subform at all. The subform fields basically disappear or lock. I've racked my brain and can't figure out what the problem could be. Is it because the subform table itself has more than 5 records? Am I trying to do the impossible.
Thanks for any help you can give me.
Jennifer
Form_Current
If RecordsetClone.RecordCount >= 5 Then
Me.AllowAdditions = False
End If
End Sub
Or:
Private sub Form_BeforeInsert (Cancel as Integer)
If Me.recordcount >= 5 Then
Cancel = true
Me.Undo
End If
End sub
The result has been that when I add a new record to the Main Form, I can't add any records to the subform at all. The subform fields basically disappear or lock. I've racked my brain and can't figure out what the problem could be. Is it because the subform table itself has more than 5 records? Am I trying to do the impossible.
Thanks for any help you can give me.
Jennifer