How to get the name of the button that was clicked in LS

I have quite a few buttons on a workflow form that perform many of the same functions. I was wondering if there was a way using LS, to determine which button was clicked i.e. Assign Project or Project Completed. Then using the Goto command call a sub routine to process everything that is in common but then process only functions applicable to the particular button the user presses. I know the button is an object but I can’t seem to find any way to drill down to it.

I may be asking a lot but I would also like to programmatically change the name of the Action button on the form, in in the queryopen event, based on a flag set in a field. Is this possible?

Any help would be greatly appreciated

Subject: How to get the name of the button that was clicked in LS

“I was wondering if there was a way using LS, to determine which button was clicked i.e. Assign Project or Project Completed.”

Sure; write your function in a script library (or at least in global scope for the form) and call it from the various buttons by passing the button name (or some other suitable identifier) in for an argument. Then your function code conditionally executes various statements based on the button ID that was passed in to it.

“I would also like to programmatically change the name of the Action button on the form, in in the queryopen event, based on a flag set in a field.”

Even simpler. In R4/R5, you’d have to create multiple buttons and use Hide-When formulas to control which one was visible. In R6, you simply use the Action’s Label property to programmatically set the label.

Subject: RE: How to get the name of the button that was clicked in LS

Bruce,

Thank you for your response but I am somewhat new to LS so I was wondering if you could give me the hiararcy to follow when trying to capture the button name? I looked in help but could not find anything.

I looked into script libraries to figure out how to call a function some time ago but could never figure it out. I know you have to do a Use then a call but not much more than that.

Subject: RE: How to get the name of the button that was clicked in LS

There’s no way for a Click event to get the name of the button that was clicked. Bruce is suggesting that you hardcode the button name into the arguments you pass to the subroutine that does the actual work. So for a button called “Activate” you would write a script such as:

Sub Click(Source As Button)

Call SomeRoutineName("Activate")

End Sub