T
Tom
How can I find the first blank control on a form by looking at the controls
in the order of their tab order?
Thanks!
Tom
in the order of their tab order?
Thanks!
Tom
How can I find the first blank control on a form by looking at the controls
in the order of their tab order?
Thanks, John!
I was still wondering how to get the controls in tab order. Where can I find
a list of the constants for each type of control?
Tom
John Nurick said:Tom,
For the constants, look up ControlType in the Object Browser.
One way of getting them in tab order is along these lines:
Dim colC As New VBA.Collection
Dim j as Long
Dim lngHighestTabIndex As Long
...
lngHighestTabIndex = 0
'store relevant names and tab indexes in collection
For Each ctlC in Me.Controls
With ctlC
Select Case .Type
Case acBlah, acSomething, acSomethingElse...
colC.Add ctlC.Name, Format(.TabIndex, "000")
If .TabIndex > lngHighestTabIndex Then
lngHighestTabIndex = .TabIndex
End If
End Select
Next 'ctlC
'Iterate through the stored control names in TabIndex order
On Error Resume Next
For j = 1 To lngHighestTabIndex
strCtlName = colC.Item(Format(j, "000"))
If Err.Number = 0 Then
If [control is blank] Then
Exit For
End If
End If
Err.Clear
Next j
On Error GoTo 0