passing the name of a control

  • Thread starter Thread starter Mark Kubicki
  • Start date Start date
M

Mark Kubicki

if I need to pass the name of a form in the OenArgs of a command button's
click
(the command button is on that form), the code behind it is something like
this:

DoCmd.OpenForm...openArgs:=me.name

how do I pass the name of the control that fired the event in the OpenArgs
parameters?

thanks in advance,
mark
 
THANKS... ONE MORE QUESTION: how do I mark a post as answered? (I use
Outlook Express as my newsgroup reader)

-mark
 
CLARIFICATION:

is there code that I could use behind ANY button to pass the name of THAT
button?
do I enter a line of code like this:
DoCmd.OpenForm stDocName, , , stLinkCriteria, , ,
OpenArgs:=Me.Controls.Name
or,
do I need to enter the the actaul name of the control
DoCmd.OpenForm stDocName, , , stLinkCriteria, , ,
OpenArgs:="ControlName"

thanks (again) in advance,
-m.
 
If you want the name of the control, you would use
OpenArgs:=Me.YourControlName.Name
The .Name says to get the name of the control, not its value. Lets say your
buttons name is FindCustomer, then your code would be...
DoCmd.OpenForm stDocName,,,stLinkCriteria,,,Me.FindCustomer.Name

Control names dont change unless you change them. You could simply state
the name explicitly like this
DoCmd.OpenForm stDocName,,,stLinkCriteria,,,"FindCustomer"
 
Back
Top