Stuart McLachlan
stuart at lexacorp.com.pg
Tue Jan 24 17:14:58 CST 2012
Yes. Use Form("controlname") addressing with string concatenation.
For x = 1 to 5
Forms.form1("Button" & x).ForeColor = vbBlue
Next
--
Stuart
On 24 Jan 2012 at 17:06, Brad Marks wrote:
> 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
>
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
--
Stuart McLachlan
Ph: +675 340 4392
Mob: +675 7100 2028
Web: http://www.lexacorp.com.pg