[AccessD] Find Label text attached to Text Box

dmcafee at pacbell.net dmcafee at pacbell.net
Wed Mar 30 18:35:06 CST 2005


wouldn't me.name return the form or reports name?

I think you meant to type Me.ActiveControl.Name


David McAfee


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Stuart
McLachlan
Sent: Wednesday, March 30, 2005 4:16 PM
To: Access Developers discussion and problemsolving
Subject: Re: [AccessD] Find Label text attached to Text Box


On 30 Mar 2005 at 18:07, Gregg wrote:

> If you have a Text Box with an attached Label is there some way to find
the Label Text when you only know the Text Box Name?
> --

Simplest way is to use a standard naming convention for controls such as
always name the label the same as the textbox, but with a different prefix.

so txtMyFirstTextBox would have a label called lblMyFirstTextBox.

Then the label's name will always be "lbl" & mid$(me.name,4).


Otherwise you have to step through the controls collection of the form and
check all the labels, looking for the one who's "parent" property is
txtMyFirstTextBox


--
Stuart


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