473,396 Members | 1,849 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,396 software developers and data experts.

Return Name Of Subform Control

I have forty-two small subforms on a form. I need help with the code that
will return the name of the subform control when I click on any subform
control. I know how to select all the subform controls at once and then
enter =MyFunction in the Enter event; I need the code for MyFunction.

Thanks,

Melissa
Nov 13 '05 #1
3 2454
"Melissa" <ms****@notmyemail.com> wrote in message
news:RW*****************@newsread3.news.pas.earthl ink.net
I have forty-two small subforms on a form. I need help with the code
that will return the name of the subform control when I click on any
subform control. I know how to select all the subform controls at
once and then enter =MyFunction in the Enter event; I need the code
for MyFunction.


I believe that in the subform control's Enter event,

Me.ActiveControl.Name

will give you the name of the subform control.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
Nov 13 '05 #2
It is not clear what you are trying to do. But if you want to set the
name of a subform to a variable when you enter that subform - just do
this: Create a module level variable in the main form

-----------------------------------------
Dim subFrmName As String

Private Sub Form3_Enter()
subFrmName = Form3
End Sub
==========================================

or if you want to pass the actual subform to a function when you enter
the subform, do this:

==========================================
Private Sub Form3_Enter()
Me.Form3!Text0 = "testingjhgkjhg"
End Sub
------------------------------------------

where Text0 is a textbox in Form3. What does MyFunction do? What kind
of data does it return?
Rich

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #3
Ciao Melissa,

Following what Dick Goldbar wrote, I would add the following:

Where will MyFunction() be?

1. If it is in the form's module then MyFunction() could be:

Public Function MyFunction()

MsgBox "I'm in subform: " & Me.ActiveControl.Name
' your code etc.

End Function

The 'On enter' event property for each subform control should be:
=MyFunction()

2. If it is in a global module then MyFunction() should be:

Public Function MyFunction(rfrm As Form)

MsgBox "I'm in subform: " & rfrm.ActiveControl.Name
' your code etc.

End Function

The 'On enter' event property for each subform control should be:
=MyFunction([Form])

Cheers,

Mike Watson
Connecting Software
via Lodovico il Moro 87
20143 Milano, Italy

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: CSDunn | last post by:
Hello, In Access ADP's that connect to SQL Server databases, any time I have a situation where I have a combo box in a main form that looks up a record in a subform, the subform record source has...
12
by: MLH | last post by:
I have created two forms: frmBrowseNegsMainform and frmBrowseNegsSubform. I put a subform control on the first of these. The SourceObject property for the subform control is, of course,...
5
by: keith | last post by:
This may seem simple, but I'm having a bit of trouble figuring out exactly how to do it. I'm accessing a database through an ODBC link, and I have a query that returns only jobs completed that day...
1
by: tdmailbox | last post by:
I have the statment below that turns off allow edits so thatwhen I run the commend acCmdFind I only see the find menu rather then find and replace. The search button is on the parent form,...
2
by: pietlinden | last post by:
I have a stupid question (so finish swallowing now... I don't want to be accused of any beverage-related mishaps). I have a form with several subforms, with each subform on a separate tab. I'm...
2
by: maxjake via AccessMonster.com | last post by:
Hi I have a subform with one text field. I want to show just the text, NO header, No name etc. I dont know how to remove the name. (The subform is in datasheet view) Thanks Max --
6
by: DMUM via AccessMonster.com | last post by:
Hello I am trying to pass the name of my subform to a function/sub but I can't seem to get it to work. I am using an autokey function (ctrl E) to unlock text boxes on a subform. I have a few...
7
by: ApexData | last post by:
I am using the following code in my TabControl to manage subform loads. The code assigns the subForms SourceObject. - Do I also need code to DeAssign the SourceObject when leaving the Tab, I'm...
4
by: AdamOnAccess | last post by:
Hi Gang, I'm trying to write a public subroutine that returns a user to a specific row in a subform. Here's what I have so far... Public Sub psubGoToRecordInSubform(ctrSubForm As Control, intID...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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?
0
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...
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
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...
0
tracyyun
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...
0
agi2029
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 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.