![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I'm using Access 2010. I want to use VBA to change the back color of labels in the footer of all continuous forms in my application. Using: For Each ctrl In Frm.Section(acFooter).Controls debug.print ctrl.Name, ctrl.ControlType Next The loop runs and picks up the names of text boxes and buttons, but doesn't pick up any labels. If I use: For Each ctrl In Frm.Section(acHeader).Controls it picks up the labels in the form header. Can anyone give me an idea what I'm doing wrong? |
#3
| |||
| |||
|
|
On 28/07/2011 09:11:57, "Bob Darlington" wrote: I'm using Access 2010. I want to use VBA to change the back color of labels in the footer of all continuous forms in my application. Using: For Each ctrl In Frm.Section(acFooter).Controls debug.print ctrl.Name, ctrl.ControlType Next The loop runs and picks up the names of text boxes and buttons, but doesn't pick up any labels. If I use: For Each ctrl In Frm.Section(acHeader).Controls it picks up the labels in the form header. Can anyone give me an idea what I'm doing wrong? I think you need ctl.controls.item(0).backcolor Anyway this typed in the immediate window gibes the label's name ?forms!clubs.Clubname.controls.item(0).name Phil |
#4
| |||
| |||
|
|
"Phil" <phil (AT) stantonfamily (DOT) co.uk> wrote in message news:j0r77g$454$1 (AT) speranza (DOT) aioe.org... On 28/07/2011 09:11:57, "Bob Darlington" wrote: I'm using Access 2010. I want to use VBA to change the back color of labels in the footer of all continuous forms in my application. Using: For Each ctrl In Frm.Section(acFooter).Controls debug.print ctrl.Name, ctrl.ControlType Next The loop runs and picks up the names of text boxes and buttons, but doesn't pick up any labels. If I use: For Each ctrl In Frm.Section(acHeader).Controls it picks up the labels in the form header. Can anyone give me an idea what I'm doing wrong? I think you need ctl.controls.item(0).backcolor Anyway this typed in the immediate window gibes the label's name ?forms!clubs.Clubname.controls.item(0).name Phil Thanks Phil. I tried your suggestion using: With Frm.Section(acFooter).Controls vCount = .Count For i = 0 To vCount - 1 Debug.Print .Item(i).ControlName 'Note - '.Name' gives same result vCount returns 44 controls which is correct. But only 17 print out (including only 1 of I need to be able to access every control in the footer. But how? |
#5
| |||
| |||
|
|
I'm using Access 2010. I want to use VBA to change the back color of labels in the footer of all continuous forms in my application. Using: For Each ctrl In Frm.Section(acFooter).Controls * * debug.print ctrl.Name, ctrl.ControlType Next The loop runs and picks up the names of text boxes and buttons, but doesn't pick up any labels. If I use: For Each ctrl In Frm.Section(acHeader).Controls it picks up the labels in the form header. Can anyone give me an idea what I'm doing wrong? -- Bob Darlington Brisbane |
#6
| |||
| |||
|
|
I'm using Access 2010. I want to use VBA to change the back color of labels in the footer of all continuous forms in my application. Using: For Each ctrl In Frm.Section(acFooter).Controls debug.print ctrl.Name, ctrl.ControlType Next The loop runs and picks up the names of text boxes and buttons, but doesn't pick up any labels. If I use: For Each ctrl In Frm.Section(acHeader).Controls it picks up the labels in the form header. Can anyone give me an idea what I'm doing wrong? -- Bob Darlington Brisbane |
![]() |
| Thread Tools | |
| Display Modes | |
| |