Hi All,
Help with the following would be appreciated (Access97).
I have a 'generic' function that (attempts) to set the SpecialEffect property of all TextBoxes on the specified form. Problem is that the Forms that call this function contain a variable number of SubForms and I would like to set the SpecialEffect property of TextBoxes in the SubForms too. The code looks like this:
-----------------
Function UpdateSFX(Myform As Form, SFX As Integer)
Dim MyControl As Control, MySubControl As Control
For Each MyControl In MyForm.Controls
Select Case MyControl.ControlType
Case acTextBox
MyControl.SpecialEffect = SFX
Case acSubform
For Each MySubControl In MyControl.Controls
MySubControl.SpecialEffect = SFX
Next MySubControl
End Select
Next MyControl
End Function
-----------
This works fine for the 'Case acTextBox' clause but not for the 'Case acSubform' clause.
I tried explicity stating a subform as in:
'For Each MySubControl In Me.{MySubformName}.Controls'
in a separate function for a known form and it worked, so what am I doing wrong/ whats missing in the first case?
Many thanks.
[This message has been edited by Dembrey (edited 03-11-2002).]
Help with the following would be appreciated (Access97).
I have a 'generic' function that (attempts) to set the SpecialEffect property of all TextBoxes on the specified form. Problem is that the Forms that call this function contain a variable number of SubForms and I would like to set the SpecialEffect property of TextBoxes in the SubForms too. The code looks like this:
-----------------
Function UpdateSFX(Myform As Form, SFX As Integer)
Dim MyControl As Control, MySubControl As Control
For Each MyControl In MyForm.Controls
Select Case MyControl.ControlType
Case acTextBox
MyControl.SpecialEffect = SFX
Case acSubform
For Each MySubControl In MyControl.Controls
MySubControl.SpecialEffect = SFX
Next MySubControl
End Select
Next MyControl
End Function
-----------
This works fine for the 'Case acTextBox' clause but not for the 'Case acSubform' clause.
I tried explicity stating a subform as in:
'For Each MySubControl In Me.{MySubformName}.Controls'
in a separate function for a known form and it worked, so what am I doing wrong/ whats missing in the first case?
Many thanks.
[This message has been edited by Dembrey (edited 03-11-2002).]