472,358 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,358 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 2374
"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: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
1
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...

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.