[AccessD] Refering to a control with a variable

Dale_Anne Kalsow dkalsow at yahoo.com
Thu May 20 09:31:26 CDT 2010


Good Morning,
 
This is what I am trying to do:
 
    Forms![frmDate]![frmsubMonth].Form![subForm8].Form![lblDate].Caption = "jj"
    Dim intLoop As Integer
    intLoop = 8
    Me.Controls.Item("Forms![frmDate]![frmsubMonth].Form![subForm" & intLoop & "].Form![lblDate]").Caption = "Access"
 
The first line works.  Can anyone tell me why the last one does not?

Thanks in advance.
 
Dale
--- On Wed, 5/19/10, Stuart McLachlan <stuart at lexacorp.com.pg> wrote:


From: Stuart McLachlan <stuart at lexacorp.com.pg>
Subject: Re: [AccessD] Refering to a control with a variable
To: "Access Developers discussion and problem solving" <accessd at databaseadvisors.com>
Date: Wednesday, May 19, 2010, 10:15 PM


Me.Controls.Item("txtbox" & Trim(Str(IntA)))

(the "Me." is optional)

-- 
Stuart


On 19 May 2010 at 19:17, Dale_Anne Kalsow wrote:

> Good Evening,   If I have a control named txtbox1 and a variable of intA
> with a value of 1, does anyone know how to refer to the control in VBA
> with with something simular to "txtbox" & intA?   Thanks!   Dale 
> 
> 
>       
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 



-- 
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