How loop thru form controls?

F

Fjordur

Hi,
I have VB code that loops through the controls of a form. Actually the code
is called on the BeforeUpdate event of each control, and loops only on the
controls that have a tab order >= to the tab order of the control that's
being updated.
I wrote a loop based on the TabIndex property of each control of the form,
rougly something like:
loop on myTabIndex
For Each aControl In myForm.Controls
If aControl.TabIndex = myTabIndex Then
CheckIndividualControl myForm, aControl
End If
Next
Wend ' plus some refinements
The problem is, on some forms there are tab controls, and I find to my
surprise that the tab control has a TabIndex that's the same as the TabIndex
of controls on the tab. Therefore, the loop above misses these controls.
How can I loop through all controls (textboxes, checkboxes, combos..) on a
form?
 

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