473,387 Members | 1,790 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to refer to a control by name

344 Expert 100+
I need a way of finding the name of the active control on a form.

You can use currentdb() to refer to the current database

You can use Me to refer to the active form or report.

I need a function that I can put into the got_focus event of a control on the form that says DoMyCode xxx where xxx is the active control.

Obviously I could do DoMyCode Me.thisCtrlName but I will be doing this for for over 400 controls and am looking for something generic like
DoMyCode Me.ActiveCtl

Does such a property or feature exist?
Jul 25 '07 #1
4 2562
Rabbit
12,516 Expert Mod 8TB
Me.ActiveControl.Properties("Name")
Jul 25 '07 #2
Lysander
344 Expert 100+
Me.ActiveControl.Properties("Name")
Perfect, thanks for that
Jul 26 '07 #3
Lysander
344 Expert 100+
Perfect, thanks for that
Well, almost perfect. The global code does not recognise Me, but Screen.activecontrol works.
Jul 26 '07 #4
Rabbit
12,516 Expert Mod 8TB
Good Luck.
Jul 26 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: octagon | last post by:
Hi, I have a form with various types of control such as txtbox, combo box, listbox, subform and check box I am trying hard to write a code for a check box after check the box all the control in...
3
by: Joshua Ammann | last post by:
Hi, (Using Access 2000) I have two tables, similar to Customers and Orders. (Not an exact parallel, but works for this example.) On a form showing customer data, there is a tab control. One...
1
by: MP | last post by:
I have a main form that has a subform which also has a subform: the main form is the first subform is the second subform is When I click on the button »AddNewSubSubRecord« (add a new record...
4
by: ad | last post by:
I have a string variable string sID; sID store the ID of a TextBox. I want to refer TextBox throw sID. like (TextBox which ID is sID).Text="text"; How can I do that ?
3
by: Tim::.. | last post by:
Can someone please tell me how I refer to a Hyperlink object in a usercontrol from a sub in another aspx page??? I want to change the visibile attribute of a hyperlink in a user control from an...
2
by: GY2 | last post by:
How do I refer to controls by a string variable name instead of by integer item index? A form contains 7 rich textbox controls labeled rtb1-rtb7. In VB6 I could use the following code to loop...
10
by: Bill Nguyen | last post by:
I have several textbox controls in a form,. I name them txt1, txt2, ... txt10. How dow I refer to them in a loop to get the value in text proerty of each control? For x = 1 to 10 value =...
4
by: john | last post by:
I have a bound textfield in my form. In the beforeupdate event of that field I want to refer to that field's value. What's the easiest way to refer to that field's value? st = MyFieldName works...
1
by: inglesp | last post by:
Does anybody know if it's possible to specify the name of a control created by CreateReportControl? I have txtNew = CreateReportControl(...) and I can refer to the control as txtNew immediately...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.