M
Marcus
Hi there,
using Access 2003 I'd like to give users the opportunity to change
application font size on form's objects.
To do so I've set up on the menubar a font size option.
When font size is changed I need to iterate all objects on forms and change
font size.
I've set up a public function that iterates all objects in the forms
collection and changes font size, and it works for main forms.
When trying to use the same function in a recursive way to modify subforms I
get a runtime error 2450 ".... can't find the form 'form_name' refrred to in
a macro expressione or visual basic..."
here's the code:
'*********************** VBCODE
Public Function setFontSize(fntSize As Integer)
Dim Objform As Form
If globalFontSize <> fntSize Then 'changed fontsize
globalFontSize = fntSize
For Each Objform In Application.Forms 'iterate the Forms collection
setFormAttributes(Objform.Name) 'call function to change
fontsize
Next
End If
End Function
Public Function setFormAttributes(frmName As String)
Dim ctl As Control
For Each ctl In Forms(frmName).Controls 'iterate object collection
'<<<<<<<< offending instruction
Select Case ctl.ControlType
Case acComboBox, acCommandButton, acLabel, acListBox, acListBox,
acTextBox, acToggleButton 'capable objects
ctl.FontSize = globalFontSize
Case acSubform
setFormAttributes (ctl.Form.Name) 'recurse here into subform
End Select
Next
End Function
'*********************** END VBCODE
Can anyone solve this problem?
using Access 2003 I'd like to give users the opportunity to change
application font size on form's objects.
To do so I've set up on the menubar a font size option.
When font size is changed I need to iterate all objects on forms and change
font size.
I've set up a public function that iterates all objects in the forms
collection and changes font size, and it works for main forms.
When trying to use the same function in a recursive way to modify subforms I
get a runtime error 2450 ".... can't find the form 'form_name' refrred to in
a macro expressione or visual basic..."
here's the code:
'*********************** VBCODE
Public Function setFontSize(fntSize As Integer)
Dim Objform As Form
If globalFontSize <> fntSize Then 'changed fontsize
globalFontSize = fntSize
For Each Objform In Application.Forms 'iterate the Forms collection
setFormAttributes(Objform.Name) 'call function to change
fontsize
Next
End If
End Function
Public Function setFormAttributes(frmName As String)
Dim ctl As Control
For Each ctl In Forms(frmName).Controls 'iterate object collection
'<<<<<<<< offending instruction
Select Case ctl.ControlType
Case acComboBox, acCommandButton, acLabel, acListBox, acListBox,
acTextBox, acToggleButton 'capable objects
ctl.FontSize = globalFontSize
Case acSubform
setFormAttributes (ctl.Form.Name) 'recurse here into subform
End Select
Next
End Function
'*********************** END VBCODE
Can anyone solve this problem?