Simple Function Question

I

igendreau

I have a basic function in a module that does some math for me based
on the parameters that I give it. When the user clicks a button on my
form, it runs the function. I put a message box at the end of the
function just to see if it's returning the right value, and it is.

How do I get that value back to the originating form? I can call the
function:

Call myFunction(Parameter1, Parameter2, Parameter3)

And it will run and pop up the correct message box. But I need that
value back so I can use it on my form however I want. How do I call
that function's result?
 
D

Damon Heron

Avariable or textbox = myFunction(P1,P2,P3)
This returns the value of the function to the calling form.

Damon
 
M

Marshall Barton

igendreau said:
I have a basic function in a module that does some math for me based
on the parameters that I give it. When the user clicks a button on my
form, it runs the function. I put a message box at the end of the
function just to see if it's returning the right value, and it is.

How do I get that value back to the originating form? I can call the
function:

Call myFunction(Parameter1, Parameter2, Parameter3)

And it will run and pop up the correct message box. But I need that
value back so I can use it on my form however I want. How do I call
that function's result?


That syntax discards the functions return value (as if it
were a Sub procedure). Us something like this instead:

myresult = myFunction(Parameter1, Parameter2, Parameter3)
 

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