Solved

Access 2000:Events:Functions - Extracting the "Current Field" name

Posted on 2004-08-30
3
308 Views
Last Modified: 2011-10-03
Is there a way I can get the currently active field's name in a user defined function?  I would like to write a function that executes a specific way given the field's name.  This way I can write a generic function that can be called by several command buttons....
0
Comment
Question by:DCCoolBreeze
  • 2
3 Comments
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 11930167
this is a duplicate - do NOT hit the Refresh button on your Browser, but rather the Reload This Question (under page options) on the EE  page.

Post a 0 point request to Community Support to have this DUPLICATE question deleted, and the points refunded.

AW
0
 
LVL 44

Accepted Solution

by:
Arthur_Wood earned 500 total points
ID: 11930196
oops'orry, did not read the full question, as the title appeared to be a duplicate.

Try:

ActiveControl.Name, or, if you are passing a reference to the control, as a argument:

Private MyFunction(ByRef MyControl as Control) as String
    MyFunction = MyControl.Name
End Function

AW
0
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 11930232
You can retrieve the control that currently has the focus by using:
Screen.ActiveControl

This returns a reference to a Control object. Screen.ActiveControl.Name will give you the control's name, but it's easier just to use the control object.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now