Hey again -
I have a bunch of similar controls on a form (A2000), and I'm calling the
same code (with an argument as to what was clicked) when any one of them is
clicked. I'd like to generalize the code without having to modify EACH one
with a self-specific parameter in the call. That is, instead of calling...
called_when_clicked ("A1")
I just want to run:
called_when_clicked (my own control name)
....without the parentheses of course. Then I could use the same exact line
of code for all the controls, and decide what to do in the called routine
(table lookups built from the control name). I have tried using
ActiveControl, but since the controls themselves are on a tab page, all I
get is the name of the tab control. And of course, "Me" refers to the form
they're all on. Is there an equivalent for the control itself?
(What I'd REALLY like would be a way to use an object-oriented approach, and
have the CLASS of control defined to make this call automagically, without
having to create a separate event procedure for every one...)
Armando 4 4717
Armando wrote: Hey again -
I have a bunch of similar controls on a form (A2000), and I'm calling the same code (with an argument as to what was clicked) when any one of them is clicked. I'd like to generalize the code without having to modify EACH one with a self-specific parameter in the call. That is, instead of calling...
called_when_clicked ("A1")
I just want to run:
called_when_clicked (my own control name)
...without the parentheses of course. Then I could use the same exact line of code for all the controls, and decide what to do in the called routine (table lookups built from the control name). I have tried using ActiveControl, but since the controls themselves are on a tab page, all I get is the name of the tab control. And of course, "Me" refers to the form they're all on. Is there an equivalent for the control itself?
(What I'd REALLY like would be a way to use an object-oriented approach, and have the CLASS of control defined to make this call automagically, without having to create a separate event procedure for every one...)
Armando
Check out the ActiveControl property in help. See also ActiveForm property.
"Salad" <oi*@vinegar.com> wrote in message
news:Sv****************@newsread2.news.pas.earthli nk.net... Armando wrote:
Hey again -
I have a bunch of similar controls on a form (A2000), and I'm calling
the same code (with an argument as to what was clicked) when any one of them
is clicked. I'd like to generalize the code without having to modify EACH
one with a self-specific parameter in the call. That is, instead of
calling... called_when_clicked ("A1")
I just want to run:
called_when_clicked (my own control name)
...without the parentheses of course. Then I could use the same exact
line of code for all the controls, and decide what to do in the called
routine (table lookups built from the control name). I have tried using ActiveControl, but since the controls themselves are on a tab page, all
I get is the name of the tab control. And of course, "Me" refers to the
form they're all on. Is there an equivalent for the control itself?
(What I'd REALLY like would be a way to use an object-oriented approach,
and have the CLASS of control defined to make this call automagically,
without having to create a separate event procedure for every one...)
Armando
Check out the ActiveControl property in help. See also ActiveForm
property.
I always list the things I've tried before asking the group to help. That
way we save posts to read through, and makes it clear that I'm not out for a
free answer, but actually expended some effort first. It's my way of
showing appreciation for the help, beforehand.
Anyway, I did try ActiveControl - and I get the name of the Tab control. I
can't see into it any deeper, unless there's another command.
Armando wrote: "Salad" <oi*@vinegar.com> wrote in message news:Sv****************@newsread2.news.pas.earthli nk.net...
Armando wrote:
Hey again -
I have a bunch of similar controls on a form (A2000), and I'm calling the same code (with an argument as to what was clicked) when any one of them is clicked. I'd like to generalize the code without having to modify EACH one with a self-specific parameter in the call. That is, instead of calling... called_when_clicked ("A1")
I just want to run:
called_when_clicked (my own control name)
...without the parentheses of course. Then I could use the same exact line of code for all the controls, and decide what to do in the called routine (table lookups built from the control name). I have tried using ActiveControl, but since the controls themselves are on a tab page, all I get is the name of the tab control. And of course, "Me" refers to the form they're all on. Is there an equivalent for the control itself?
(What I'd REALLY like would be a way to use an object-oriented approach, and have the CLASS of control defined to make this call automagically, without having to create a separate event procedure for every one...)
Armando
Check out the ActiveControl property in help. See also ActiveForm
property.
I always list the things I've tried before asking the group to help. That way we save posts to read through, and makes it clear that I'm not out for a free answer, but actually expended some effort first. It's my way of showing appreciation for the help, beforehand.
Anyway, I did try ActiveControl - and I get the name of the Tab control. I can't see into it any deeper, unless there's another command.
I have a table, Table1 with the fields Test1 and Test2. I created a
form and dropped a tab control onto it and then dropped Test1 and Test2
onto the Tab1.
Here is my code for Test1
Private Sub Test1_GotFocus()
MsgBox "Focus " & Screen.ActiveControl.Name
End Sub
Private Sub Test1_Click()
MsgBox "Clicked " & Screen.ActiveControl.Name
End Sub
Private Sub TabCtl0_Click()
MsgBox "Tab " & Screen.ActiveControl.Name
End Sub
WHen I run it, the message box say Test1 as I expected. I can set focus
to or click in Test1 and I get a message. I can click into Test2 and
click the tab control and Access echoes Test2. So...I'm sorry I can't
help you out with your problem. You might want to run a test like mine,
see if you get the same results.
"Salad" <oi*@vinegar.com> wrote in message
news:G6******************@newsread1.news.pas.earth link.net... ... ... WHen I run it, the message box say Test1 as I expected. I can set focus to or click in Test1 and I get a message. I can click into Test2 and click the tab control and Access echoes Test2. So...I'm sorry I can't help you out with your problem. You might want to run a test like mine, see if you get the same results.
Thanks for the second reply - I'll play with it some more.
Armando This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Mark |
last post by:
I have an application that uses PHP to access a MySQL table and
extract rows which match the user's search entry. Data from the
matching rows are loaded into an HTML selection list, and the user...
|
by: David |
last post by:
I know that identifying the user IP address with
HTTP_SERVER_VARS;
is reliant on the browser agent but I have stumpled upon the following
code which I have tried to understand but failed!
...
|
by: hokiegal99 |
last post by:
This is not really a Python-centric question, however, I am using
Python to solve this problem (as of now) so I thought it appropiate to
pose the question here.
I have some functions that search...
|
by: monika |
last post by:
I move from one form to another when I click to a radio button. I can
identify which radio button I clicked by trapping its value. but my problem
is that there are a set of radio buttons followed...
|
by: Joshua Beall |
last post by:
Hi All,
I've been taking a look at DB Designer 4, and looking through the
documentation (http://www.fabforce.net/dbdesigner4/doc/index.html) I am a
little unclear on some of their nomenclature:...
|
by: Adelio Stevanato |
last post by:
I am an experienced VB 3-6 developer moving to .NET.
In VB 6 i could go through the form controls collection ,
find all the menu items and using security information set-
up I could...
|
by: Christopher Weaver |
last post by:
I want to set a value in a specific field in the current row of a DataSet.
This seems like the most basic thing to do but I can't find the syntax for
identifying the current row.
IOW, I can do...
|
by: Frankie |
last post by:
It appears that System.Random would provide an acceptable means through
which to generate a unique value used to identify multiple/concurrent
asynchronous tasks.
The usage of the value under...
|
by: Michael Powe |
last post by:
Hello,
Here is my problem: I have a site that uses urls of this format to
submit forms:
<a id="1_1_2_0"
href="Javascript:if(validate)submitForm(...)">Submit</a>
I'm just a third-party...
|
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...
|
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...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |