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