B
Bob Howard
Access 2000...
In a form, I have 30 controls (all labels) that I need to set various
properties. When I do this, I make the property setting the same for each
of the 30. These 30 labels are all named Title1 through Title30.
For example, at a certain point in time I need to set the background color
to red in all 30 of these labels controls. Rather than coding:
Me!Title1.BackColor = vbRed
Me!Title2.BackColor = vbRed
..
..
..
Me!Title30.BackColor = vbRed
I would like to do this in a Do...While loop varying an integer variable
from 1 to 30.
My problem is that I can't figure out how to construct the name so that
Access likes it and treats it as a control name.
I've tried something like this (within the Do...While loop varying
numRunningCounter from 1 to 30):
Dim ctlLabelName as String
ctlLabelName = "Me!Title" & CStr(numRunningCounter)
ctlLabelName.BackColor = vbRed
I've also tried to define the name as "Control" but this failed
(differently).
Any clues would be appreciated (by the way, I don't have Northwind).
Bob (@Martureo.Org)
In a form, I have 30 controls (all labels) that I need to set various
properties. When I do this, I make the property setting the same for each
of the 30. These 30 labels are all named Title1 through Title30.
For example, at a certain point in time I need to set the background color
to red in all 30 of these labels controls. Rather than coding:
Me!Title1.BackColor = vbRed
Me!Title2.BackColor = vbRed
..
..
..
Me!Title30.BackColor = vbRed
I would like to do this in a Do...While loop varying an integer variable
from 1 to 30.
My problem is that I can't figure out how to construct the name so that
Access likes it and treats it as a control name.
I've tried something like this (within the Do...While loop varying
numRunningCounter from 1 to 30):
Dim ctlLabelName as String
ctlLabelName = "Me!Title" & CStr(numRunningCounter)
ctlLabelName.BackColor = vbRed
I've also tried to define the name as "Control" but this failed
(differently).
Any clues would be appreciated (by the way, I don't have Northwind).
Bob (@Martureo.Org)