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

which button was clicked?

Status
Not open for further replies.

tgriffin

Programmer
Jan 18, 2001
20
0
0
US
Im trying to simplify my code on a form. I have a series of command buttons, each of which go to different forms. I want to write code to check which button was last clicked and based on that value, go to a certain form. I guess I would use a Select Case statement?

I would also like to pass the parameter throughout the whole time the user is logged on if possible.

Any direction would be great!!
TIA
tgriffin
 
Since only one button can be the last button clicked, could you use an Option Group for this? Then open your form based on the option group value.

HTH

Lightning
 
Screen.PreviousControl gives access to the various properties, including the name (and for command buttons, the "Caption"). But this doesn't really simplify the process. You would still need the select case structure. Ssince you need that anyway, use the command buttons ..._OnClick event to just send a parameter to your 'master-routine'. The Parameter/message could be the comand button's name or caption or the name of the routine you want to execute ...


MichaelRed
redmsp@erols.com

There is never time to do it right but there is always time to do it over
 
If you want to track, over a period of time.. doing things between button clicks field tabs, entry etc.., the simplest way would probably be to define a form level or a module level variable to track it..

so, when you click a button, it changes the variable after you use it's value.

HTH Scott Cybak
scott@athree.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top