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

OnAction-Property of ToolbarButton needs to call a function with param

Status
Not open for further replies.

spitzmuller

Programmer
May 7, 2004
98
CH
Hi there

I am currently writing code to create a custom toolbar. At runtime, this toolbar will be populated with buttons - one for each open form - to give one-click access to all open forms.

For that i need to have the OnAction-Property call a function with an argument (the name of the button that was clicked).

I tried to use

.OnAction = "ShowForm('MainForm')"

where ShowForm is a function that brings to front the corresponding from

But it doesn't work: error: "can't run the macro or callback function". If I remove the argument from the function, it works, but I need the argument to know what button has been pressen.

I hope I can make myself clear...

Any Ideas? Thanks

 
How are ya spitzmuller . . .

. . . and this:
Code:
[blue].OnAction = "=ShowForm('MainForm')"[/blue]

Calvin.gif
See Ya! . . . . . .
 
I'm fine, AceMan. Thanks for your reply

your code is what I tried first, but I get the error:

"The expression you entered has a function name that MyDatabase can't find."

As I said: it works if the same function does not take an argument. Is it possible that .OnAction cannot call functions with arguments?

What would also help as a workaround is if you knew a way to determine in the OnAction code what button on the toolbar has been pressed (as I d'like to give all buttons the same OnAction argument).

Thanks again for your help Simon
 
Hi there again

I figured out what the problem was: my ShowForm-Procedure was defined as as Sub, but the OnAction Property needs a FUNCTION n to be called.

So I changed Sub to Function and It works a charm.

Thanks AceMan for giving me some fresh ideas about the problem... I was beginning to get desperate on this the other day :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top