Skipping Footer Controls

P

Phil Reynolds

When looping through all controls on a form in code, is it possible to
determine what section a control belongs to? I want to skip controls in the
footer for some code I'm doing.
 
S

Stuart McCall

Phil Reynolds said:
When looping through all controls on a form in code, is it possible to
determine what section a control belongs to? I want to skip controls in
the footer for some code I'm doing.

To determine which section a control belongs to:

Dim ctl As Access.Control

For Each ctl In Form.Controls
If ctl.Section <> acFooter Then
'Do something with ctl
End If
Next

or you could loop over each section seperately:

For Each ctl In Form.Section(acHeader).Controls
'Do something with ctl
Next
For Each ctl In Form.Section(acDetail).Controls
'Do something with ctl
Next
 
Top