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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Grab the sub name from within the sub ?

Status
Not open for further replies.

jgarry

Programmer
Nov 23, 2004
67
US
Hi, Thanks in advance,

I would like to be abel to grab the name of a text box from with inside the private sub. This would be use as a passing paramater

an example would be
text box: txt_PlanTotalCost

Private sub txt_plan_beforeUpdate(cancel as integer)

WAU "txt_Plan", me.txt_Plan.oldvalue, me.txt_plan.vaule

end sub

what I want to be able to do is:

Private sub txt_plan_beforeUpdate(cancel as integer)

WAU strPassString
' the function wau would make the complete line of code
' in the other function function
end sub

Jim Garry
 
Have a look at the ActiveControl property of the Form or Screen object.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PHV, I looked at that and did not quite understand it. but after playing around I found what I needed to do



I was attempting to put the .name after
screen.ActiveControl.name this was not working. I then modifiyed it to

Dim ctlCurrentControl As Control
Set ctlCurrentControl = Screen.ActiveControl
MsgBox (ctlCurrentControl.Name)
Thanks for your assistance.

Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top