Create a custom Forms collection object [SOLVED]
Hi,
I am trying to prevent code duplication such as:
I would therefore like to create a Forms collection in order to loop through it's children.
Can this be done? I couldn't find any info on the net.
Thanks for your input.
Hi,
I am trying to prevent code duplication such as:
Code:
With Me.subForm1.Form
.AllowAdditions = False
.AllowDeletions = False
.AllowEdits = False
End With
With Me.subForm2.Form
.AllowAdditions = False
.AllowDeletions = False
.AllowEdits = False
End With
I would therefore like to create a Forms collection in order to loop through it's children.
Code:
Dim frmMySubForms as Forms
'Create a collection
'??? frmMySubForms.Add(Me.subForm1.Form)
'??? frmMySubForms.Add(Me.subForm2.Form)
'Loop through it
For Each frmSubFormForm in frmMySubForms
With frmSubFormForm
.AllowAdditions = False
.AllowDeletions = False
.AllowEdits = False
End With
Next frmSubFormForm
Can this be done? I couldn't find any info on the net.
Thanks for your input.
Last edited: