Skipping Footer Controls

  • Thread starter Thread starter Phil Reynolds
  • Start date Start date
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.
 
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
 

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

Back
Top