[AccessD] Refering to a control with a variable

Gustav Brock Gustav at cactus.dk
Thu May 20 09:52:46 CDT 2010


Hi Dale

This should do:

    Forms![frmDate]![frmsubMonth].Form("subForm" & intLoop & "").Form![lblDate].Caption = "Access"

/gustav


>>> dkalsow at yahoo.com 20-05-2010 16:31 >>>
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 






More information about the AccessD mailing list