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

Brad Marks BradM at blackforestltd.com
Tue Jan 24 17:38:09 CST 2012


Stuart and Charlotte,

Thanks for the help.

I really appreciate it.

Brad 


-----Original Message-----
From: accessd-bounces at databaseadvisors.com on behalf of Stuart McLachlan
Sent: Tue 1/24/2012 5:14 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Question Regarding Changing Multiple Controls(Buttons) on a Form
 
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

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.




More information about the AccessD mailing list