Number of records in a subform

M

Megen

I am trying to limit the number of records in a subform to (1). Is it controlled by the relationship between the main form and the subform, or through properties?
 
E

Elwin

Use the OnCurrent() event of your main form to toggle
the 'AllowAdditions' property of your subform.

Private Sub Form_Current()
Dim frm As Form
Set frm = Me!mySubFormControlName.Form
If Me.NewRecord Then
frm.AllowAdditions = True
ElseIf frm.RecordsetClone.RecordCount = 0 Then
frm.AllowAdditions = True
Else
frm.AllowAdditions = False
End If
End Sub

good luck.
-----Original Message-----
I am trying to limit the number of records in a subform
to (1). Is it controlled by the relationship between the
main form and the subform, or through properties?
 
Top