making a call from form code


Posted by Chris on December 05, 2001 5:08 PM

Hi -

Can anyone tell me how to I need to set up code within a form so that it can call a function that is not in the written in the forms section(ie in a module or elsewhere)?

Thanks,
Chris

Posted by Juan Pablo G. on December 05, 2001 7:37 PM

If you haven't declared the function as Private it should be available, meaning, you can just call it using

Result = FunctionName(Parameters)

Juan Pablo G.

Posted by Chris on December 05, 2001 9:30 PM

Juan -

Thanks for the help... however, the solution doesnt seem to work from code behind a form for some reason. are you sure that its possible to make function calls from a form? have you used them in code before?

thanks,
Chris



Posted by Juan Pablo G. on December 05, 2001 9:38 PM

I'm currently on a project that has just that. Three UserForms, one UDF. I just created this dummy code in a Cancel Button.

Private Sub BCancel_Click()
MsgBox Premium(22408, 0.08 / 12, 60, 0.045)
Me.Hide
End Sub

Where Premium is my UDF (Located in a separated Module).

I don't think that version has to do with that, but what are you using ?

Juan Pablo G.