inso18
02-26-2007, 07:57 AM
Hello, I've just joined, good to be here.
I have a quick question: How is it possible to concentrate a string var. with form or control name? I would like to be able to find a specific subform control and assign it as a form variable:
Dim strSubformName As String
Dim frm1, frm2 As Form
Dim ctl, ctl2 As Control
Set frm1 = Me.Customers
For Each ctl1 In frm1.Controls
If Left(ctl1.Name, 3) <> "cmd" Then
'find subforms only
strSubformName = ctl.name
Set frm2 = Forms!Customers!&strSubformName 'doesn't work
'change something in subform
For Each ctl2 in frm2.Controls
ctl2.Top = ctl2.Top + 20
Next ctl2
Set frm = Nothing
End If
Next ctl1
Thanks very much for your attention,
Michael
I have a quick question: How is it possible to concentrate a string var. with form or control name? I would like to be able to find a specific subform control and assign it as a form variable:
Dim strSubformName As String
Dim frm1, frm2 As Form
Dim ctl, ctl2 As Control
Set frm1 = Me.Customers
For Each ctl1 In frm1.Controls
If Left(ctl1.Name, 3) <> "cmd" Then
'find subforms only
strSubformName = ctl.name
Set frm2 = Forms!Customers!&strSubformName 'doesn't work
'change something in subform
For Each ctl2 in frm2.Controls
ctl2.Top = ctl2.Top + 20
Next ctl2
Set frm = Nothing
End If
Next ctl1
Thanks very much for your attention,
Michael