passing the name of a control

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
 
M

Mark Kubicki

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

-mark
 
M

Mark Kubicki

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.
 
R

Ryan

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"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top