Connecting Tech Pros Worldwide Forums | Help | Site Map

Call Function

Steve
Guest
 
Posts: n/a
#1: Nov 13 '05
What is the syntax to call Public Function MyFunction(parm1, parm2) in
MyForm's module from a function in a standard module?

Thanks,

Steve



Terry Kreft
Guest
 
Posts: n/a
#2: Nov 13 '05

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]


Steve
Guest
 
Posts: n/a
#3: Nov 13 '05

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 Microsoft Access / VBA bytes