Connecting Tech Pros Worldwide Help | Site Map

Call Function

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 13th, 2005, 07:17 AM
Steve
Guest
 
Posts: n/a
Default Call Function

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, 07:17 AM
Terry Kreft
Guest
 
Posts: n/a
Default 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, 07:18 AM
Steve
Guest
 
Posts: n/a
Default 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]


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.