Connecting Tech Pros Worldwide Help | Site Map

Call Function

  #1  
Old November 13th, 2005, 08:17 AM
Steve
Guest
 
Posts: n/a
What is the syntax to call Public Function MyFunction(parm1, parm2) in
MyForm's module from a function in a standard module?

Thanks,

Steve


  #2  
Old November 13th, 2005, 08:17 AM
Terry Kreft
Guest
 
Posts: n/a

re: Call Function


You have to get an instance of the form loaded to do this.

Dim f As Form_MyForm
Dim parm1
Dim parm2

DoCmd.OpenForm ("MyForm")

Set f = Forms("MyForm")

Call f.MyFunction(parm1, parm2)

Set f = Nothing

DoCmd.Close acForm, "MyForm"


...

--
Terry Kreft


"Steve" <nospam@nospam.spam> wrote in message
news:ALQOd.7274$oO.4116@newsread2.news.atl.earthli nk.net...[color=blue]
> What is the syntax to call Public Function MyFunction(parm1, parm2) in
> MyForm's module from a function in a standard module?
>
> Thanks,
>
> Steve
>
>[/color]


  #3  
Old November 13th, 2005, 08:18 AM
Steve
Guest
 
Posts: n/a

re: Call Function


Terry,

Will this work?

MyForm is already open before the function in the standard module is run. So
just put this line of code in the function:
Call Forms!MyForm.MyFunction(parm1, parm2)

Thanks,
Steve



"Terry Kreft" <terry.kreft@mps.co.uk> wrote in message
news:DwGdneW9k8JLQ5bfSa8jmA@karoo.co.uk...[color=blue]
> You have to get an instance of the form loaded to do this.
>
> Dim f As Form_MyForm
> Dim parm1
> Dim parm2
>
> DoCmd.OpenForm ("MyForm")
>
> Set f = Forms("MyForm")
>
> Call f.MyFunction(parm1, parm2)
>
> Set f = Nothing
>
> DoCmd.Close acForm, "MyForm"
>
>
> ...
>
> --
> Terry Kreft
>
>
> "Steve" <nospam@nospam.spam> wrote in message
> news:ALQOd.7274$oO.4116@newsread2.news.atl.earthli nk.net...[color=green]
> > What is the syntax to call Public Function MyFunction(parm1, parm2) in
> > MyForm's module from a function in a standard module?
> >
> > Thanks,
> >
> > Steve
> >
> >[/color]
>
>[/color]


Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Call function at runtime leaf answers 12 March 4th, 2006 07:55 AM
Call function in codebehind from jscript in aspx page moondaddy answers 2 November 18th, 2005 05:49 AM
call function from class Dave answers 4 November 17th, 2005 12:23 AM
Call function PawelR answers 2 November 16th, 2005 04:01 PM
Call Function Lucy Randles answers 5 November 13th, 2005 06:02 AM