Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to get active form name and current field from menu button

Status
Not open for further replies.

zionman4

Programmer
Mar 12, 2003
48
US
Hello everyone,
I have developed a search form that users can call within the active form by pressing Ctrl + F. The search form is composed of a combo box with the column names of the active form and a text box for the search criteria. I currently pass the name of the form and named of the field with code on the On Key Down of each column within the active form. I have also created a Menu Button that opens the search form for those users not using the Ctrl + F. How can I pass the name of the active form and name of the field where the cursor is when I press the menu button?

I need the form name and field name to generate the record source of the combo box. The underlying source of the combo box within the search form is a table with the name of the form and its columns.

Any help would be greatly appreciated.

Z
 
Thanks! Half way there!!

I got the Screen.ActiveForm to give me the name of the form but when I select Screen.ActiveControl it gives me the actual data in the attribute. I need the name of the attribute.
For example
The attribute name is FirstName and the data is John. Screen.ActiveControl gives me John and I need FirstName. Is there a way to do that? Or get the count of the attribute?
Say FirstName is the third attribute in the form and I retrieve 3?

Thanks!

Z
 
You can get the control properties, such as name, as well:

Code:
strName = Screen.ActiveControl.Name

If the user id to click a button, you will need PreviousControl.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top