[AccessD] Question Regarding Changing Multiple Controls (Buttons) on a Form

Brad Marks BradM at blackforestltd.com
Tue Jan 24 17:06:12 CST 2012


I have set up a little test Form with 5 buttons.

The following code will change the color of the text in each of the
buttons to Blue.  This all works nicely. 


Forms.form1.Button1.ForeColor = vbBlue

Forms.form1.Button2.ForeColor = vbBlue

Forms.form1.Button3.ForeColor = vbBlue

Forms.form1.Button4.ForeColor = vbBlue

Forms.form1.Button5.ForeColor = vbBlue



Now, I would like to set up a loop to change all 5 Buttons' ForeColor
with one statement instead of a statement for each button.

Is it possible to somehow have a variable in the statement?  Here is an
example of what I mean.

Forms.form1. & MyVariable & .ForeColor = vbBlue 


Thanks,
Brad





More information about the AccessD mailing list