Thought I had asked the right question and worked this out, but not quite....
I have a form and wanted to use VBA to dynamically label a group of labels ( LabelSev1, LabelSev2...LabelSev8).
Thanks to this forum, I used the following code:
For x = 1 to 8
Me.Controls("LabelSev" & x).Caption = "Severity Level" & x
Next x
Here is my problem: I moved the form into a main form as a subform.
The subform is named SavedRiskMatrixValues. The following
code works: SavedRiskMatrixValues!LabelSev1.Caption = "good"
However, I get errors when I try to generate a command like:
SavedRiskMatrixValues!("LabelSev" & x).Caption
or
Forms!SavedRiskMatrixValues!Controls("LabelSev" & x).Caption
Is there a way I can save myself from typing out each label?
Thanks in advance from a newbie.
I have a form and wanted to use VBA to dynamically label a group of labels ( LabelSev1, LabelSev2...LabelSev8).
Thanks to this forum, I used the following code:
For x = 1 to 8
Me.Controls("LabelSev" & x).Caption = "Severity Level" & x
Next x
Here is my problem: I moved the form into a main form as a subform.
The subform is named SavedRiskMatrixValues. The following
code works: SavedRiskMatrixValues!LabelSev1.Caption = "good"
However, I get errors when I try to generate a command like:
SavedRiskMatrixValues!("LabelSev" & x).Caption
or
Forms!SavedRiskMatrixValues!Controls("LabelSev" & x).Caption
Is there a way I can save myself from typing out each label?
Thanks in advance from a newbie.