I'm dealing with 2 forms:
#1 - Forms!CHANGEQUERYfrm!CHANGEQUERYSUBfrm
#2 - Forms!BGfrm
#1 is where the labels are that I want to change the fontcolor for
#2 is where the forecolor value is for all my forms in my database.
The field with the forecolor value is FONTCOLOR.value
Currently I assign the value on each form individually for each label. i.e...
But now I have a form with over 150 labels on it. I wanted to find a way I could Loop thru all the Label(objects) on my form changing them based on the value on the #2 form.
I thought I could name all labels numerically LABEL1,LABEL2,LABEL3,LABEL4,etc., and use a string in a loop to change it. Something like
Or something like that. Well I tried and I don't know why it didn't work. I think it took lblname as a literal and not an object. Can anyone fix this for me. I'm sure it's an easy fix.
#1 - Forms!CHANGEQUERYfrm!CHANGEQUERYSUBfrm
#2 - Forms!BGfrm
#1 is where the labels are that I want to change the fontcolor for
#2 is where the forecolor value is for all my forms in my database.
The field with the forecolor value is FONTCOLOR.value
Currently I assign the value on each form individually for each label. i.e...
Code:
Sub Form_Load()
LABEL1.Forecolor = Forms!BGfrm!FONTCOLOR.Value
LABEL1.Forecolor = Forms!BGfrm!FONTCOLOR.Value
End sub
I thought I could name all labels numerically LABEL1,LABEL2,LABEL3,LABEL4,etc., and use a string in a loop to change it. Something like
Code:
Sub Form_Load()
dim lblname
dim x as byte
x = 1
lblname = "LABEL" & x
Do Until x = 150
lblname.Forecolor = Forms!BGfrm!FONTCOLOR.Value
x = x + 1
Loop
End Sub
Or something like that. Well I tried and I don't know why it didn't work. I think it took lblname as a literal and not an object. Can anyone fix this for me. I'm sure it's an easy fix.