Skipping Footer Controls

Skipping Footer Controls

am 10.11.2007 15:54:35 von 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.

Re: Skipping Footer Controls

am 10.11.2007 16:17:05 von Stuart McCall

"Phil Reynolds" wrote in message
news:LCjZi.20484$JD.13757@newssvr21.news.prodigy.net...
> 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