Can't call a function

fugifox

Registered User.
Local time
Tomorrow, 00:45
Joined
Oct 31, 2006
Messages
95
I am trying to call a function (contained in Form's own module)
from the onClick() event of a button by assigning the function to the button through its properties as below
=myFunction()

The function has a single Optional parameter as below
myFunction(Optional arg as String).

The problem is that although I can call the function without the parameter
from any module, I can't call it from the Form's event if I don't specify a parameter.
Is this some kind of bug?

EDIT:
@Moderators: I accidentally submitted the topic before entering the correct title.
Please edit topic's title to "Can't call a function without specifying the Optional Parameter"
 
Last edited:
Does it work if you call it from a MessageBox? If it does then please post the whole function.
 
Does it work if you call it from a MessageBox? If it does then please post the whole function.

Thanks for the immediate reply.

What do you mean call it from a MessageBox?

I don't think posting function will help because after some debugging you can figure out that execution marker never goes inside function.
 
i'm not sure ...

it my be that such a generic function has to be in a general code module, not in the forms own modul;e
 
i'm not sure ...

it my be that such a generic function has to be in a general code module, not in the forms own modul;e

I don't think so.
As I said previously I can call the same function from other functions/subs
without providing the (optional) argument.
Problem occurs only when trying to call by directly declaring it at the button properties
 
it looks like a bug - i've just tried it and got the same response - if you dont have a parameter, you get an error message, even though the parameter is optional

the only thing i can suggest is calling with some agreed "ignore" flag

eg myfunction(-1) when you want the parameter to be ignored

little bit of coding but easy enough to do
 

Users who are viewing this thread

Back
Top Bottom