Jonathan Parminter said:
Hi, is it possible to loop through the controls of a form
in tab index order? How?
Possibly you could adapt this routine to your purpose. It just lists
the controls in a form section (e.g., the Detail section) in tab order:
'----- start of code -----
Sub ListControlsInTabOrder(sect As Access.Section)
Dim astrControlNames() As String
Dim ctl As Access.Control
Dim intI As Integer
ReDim astrControlNames(sect.Controls.Count)
On Error Resume Next
'to ignore errors due to controls with no TabIndex
For Each ctl In sect.Controls
With ctl
astrControlNames(.TabIndex) = .Name
End With
Next ctl
For intI = 0 To UBound(astrControlNames)
If Len(astrControlNames(intI)) > 0 Then
Debug.Print astrControlNames(intI)
End If
Next intI
End Sub
'----- end of code -----
When you call it, you have to pass the section object whose controls are
to be listed. For example
ListControlsInTabOrder Forms(0).Detail