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

Charlotte Foust charlotte.foust at gmail.com
Tue Jan 24 17:13:51 CST 2012


For i as integer = 1 to 4
     Forms.form1("Button" & i).ForeColor = vbBlue
Next i


Charlotte Foust

On Tue, Jan 24, 2012 at 3:06 PM, Brad Marks <BradM at blackforestltd.com>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
>
>
>


More information about the AccessD mailing list