Enumerating fields on tabbed form

G

Guest

Hi all. I am trying to run through fields on several subforms on a tabbed
control. The object is to try and find and count the tagged fields.

I am able to enumerate the controls on the main form and find out if a
control is a subform however, this is where i get stuck trying then to run
through the controls on the subform I have just identified. This is what I
have so far.

Dim i As Integer, j As Integer
Dim frm As Form

Set frm = Forms!frmInspection (This form has several subforms on a
tabbed control)
For i = 0 To frm.Count - 1
If frm(i).ControlType = acSubform Then
HELP!! I'M STUCK AS TO WHAT TO DO HERE!!
I want to find the fields that have a .tag value of "1" and update the form
field that holds the count.
End If
Next i
Any and all help is greatly appreciated.
Thanks,
Barry
 
B

Brendan Reynolds

Here's an example ...

Private Sub Command3_Click()

Dim ctl1 As Control
Dim ctl2 As Control

For Each ctl1 In Me.Controls
Debug.Print ctl1.Name
If ctl1.ControlType = acSubform Then
For Each ctl2 In ctl1.Form.Controls
Debug.Print , ctl2.Name
Next ctl2
End If
Next ctl1

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top