If you are trying to resize the controls in a form and any subforms that it
contains, the example below shows how to do that.
It actually resizes everything to 1 inch--not very useful, but it
demonstrates the technique of calling the subforms recursively.
Function ResizeFormControls(frm As Form, Optional ParentFormName As String)
Dim ctl As Control
Dim strThisForm As String
If Len(ParentFormName) = 0 Then
strThisForm = frm.Name
Else
strThisForm = ParentFormName & "." & frm.Name & ".Form"
End If
For Each ctl In frm.Controls
Debug.Print strThisForm & "." & ctl.Name
If ctl.ControlType = acSubform Then
Call ResizeFormControls(ctl.Form, strThisForm)
Else
ctl.Width = 1440
End If
Next
End Function
Definition of recursive: See recursive.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"WindAndWaves" <ac****@ngaru.com> wrote in message
news:Jh*******************@news.xtra.co.nz...
I have a function that increases the size of each control on a form. I
would like to do the same on a sub form, but this does not seem to work.
My syntax thus far is
set frm = screen.activeform
for each ctl in frm.controls
ctl.width = ctl.width + 1
....
if ctl.controltype = acsubform then
set Subfrm = frm.controls(ctl.name).form
for each subCtl in subfrm
...
next subCtl
next ctl
everything works fine, but I do not seem to be able to set the subform as
a form object.
Does anyone have any idea on how to make this function work???
TIA
- Nicolaas