[AccessD] Refering to a control with a variable

Dale_Anne Kalsow dkalsow at yahoo.com
Thu May 20 10:34:58 CDT 2010


That worked Great - thanks!
 
Now----- why does the 2nd line work but not the 3rd?
 
intloop=8
Forms![frmDate]![frmsubMonth].Form![subForm8].visible = False
Forms![frmDate]![frmsubMonth].Form!("subFrom" & intloop & "").visible = False
 
Thanks Again!
 
Dale

--- On Thu, 5/20/10, Gustav Brock <Gustav at cactus.dk> wrote:


From: Gustav Brock <Gustav at cactus.dk>
Subject: Re: [AccessD] Refering to a control with a variable
To: accessd at databaseadvisors.com
Date: Thursday, May 20, 2010, 9:52 AM


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 



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