A
ALESSANDRO Baraldi
Hi all.
I try to build a Class sistem to validate the control
on a PrincipalForm/SubForm/SubSubForm
Development:
1 clsControls as CollectionClass
1 clsTextBox
1 clsCombo
1 clsListBox
On a clsControls(collectionClass) i build a recursive
function like this:
' ObjectClass Declarations
Private m_Form As Access.Form ' The Form containing the
controls
Private colControls As New Collection ' Collection for control
classes
Private cTBox As clsTextBox ' TextBox class
Private cCbo As clsComboBox ' Combo class
Private cLbo As clsListBox ' ListBox class
Private Function Create(frm As Access.Form)
Dim ctl As Access.Control
For Each ctl In frm.Controls
If ctl.Tag = m_TAG Then
Select Case ctl.ControlType
Case acTextBox
Set cTBox = New clsTextBox
cTBox.SetTarget ctl
colControls.Add cTBox
Set cTBox = Nothing
Case acComboBox
Set cCbo = New clsComboBox
cCbo.SetTarget ctl
colControls.Add cCbo
Set cCbo = Nothing
Case acListBox
Set cLbo = New clsListBox
cLbo.SetTarget ctl
colControls.Add cLbo
Set cLbo = Nothing
Case acSubform
Create ctl.Form
End Select
End If
Next ctl
End Function
On clsTextBox/comboBox/ListBox i have a Function "SetTarget"
wich generate Control_BeforeUpdate = "[Event Procedure]"
and inside Class i put a MSGBOX(for now on Before Update to check it)
If i have Form/SubForm only all work very good, all my Events are detected
in every two Forms and in every controlType.
If i add the 3° level SUbSubForm, the recoursive Function add correctly the
news 3° Level Controls on Collection, to check it i cycle trought it and all
OK,
but no Events are detected for the 3° Level SubSubForm Controls
What could made this problem ...?
It's Normal one or i made some mistake...?
Thanks for help
I try to build a Class sistem to validate the control
on a PrincipalForm/SubForm/SubSubForm
Development:
1 clsControls as CollectionClass
1 clsTextBox
1 clsCombo
1 clsListBox
On a clsControls(collectionClass) i build a recursive
function like this:
' ObjectClass Declarations
Private m_Form As Access.Form ' The Form containing the
controls
Private colControls As New Collection ' Collection for control
classes
Private cTBox As clsTextBox ' TextBox class
Private cCbo As clsComboBox ' Combo class
Private cLbo As clsListBox ' ListBox class
Private Function Create(frm As Access.Form)
Dim ctl As Access.Control
For Each ctl In frm.Controls
If ctl.Tag = m_TAG Then
Select Case ctl.ControlType
Case acTextBox
Set cTBox = New clsTextBox
cTBox.SetTarget ctl
colControls.Add cTBox
Set cTBox = Nothing
Case acComboBox
Set cCbo = New clsComboBox
cCbo.SetTarget ctl
colControls.Add cCbo
Set cCbo = Nothing
Case acListBox
Set cLbo = New clsListBox
cLbo.SetTarget ctl
colControls.Add cLbo
Set cLbo = Nothing
Case acSubform
Create ctl.Form
End Select
End If
Next ctl
End Function
On clsTextBox/comboBox/ListBox i have a Function "SetTarget"
wich generate Control_BeforeUpdate = "[Event Procedure]"
and inside Class i put a MSGBOX(for now on Before Update to check it)
If i have Form/SubForm only all work very good, all my Events are detected
in every two Forms and in every controlType.
If i add the 3° level SUbSubForm, the recoursive Function add correctly the
news 3° Level Controls on Collection, to check it i cycle trought it and all
OK,
but no Events are detected for the 3° Level SubSubForm Controls
What could made this problem ...?
It's Normal one or i made some mistake...?
Thanks for help