Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Function Call ?

Geek News

Function Call ?
Scientific 12/13/2008 3:45:00 AM
Hello all,

I want a public function that I can call from any procudure. All it does is
display a message. The trouble I'm having is in the call itself. I just
want to be able to execute it when needed wherever required.

How does one call a function that passes no values?

-S
Re: Function Call ?
"Arvin Meyer [MVP]" <arvinm[ at ]mvps.invalid> 12/13/2008 3:57:38 AM
Just call it. In code:

Call MyFunction()

In the property sheet:

= MyFunction()
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"Scientific" <Scientific[ at ]discussions.microsoft.com> wrote in message
news:33FCF4E2-6481-4FD7-826D-7DAD62123170[ at ]microsoft.com...
[Quoted Text]
> Hello all,
>
> I want a public function that I can call from any procudure. All it does
> is
> display a message. The trouble I'm having is in the call itself. I just
> want to be able to execute it when needed wherever required.
>
> How does one call a function that passes no values?
>
> -S


Re: Function Call ?
Scientific 12/13/2008 4:53:00 AM
Arvin,

I created the following function module:

Public Function ShowMessage()
MsgBox "Duplicate entries will not be processed."
End Function

Then, I tried to use it in a sub routine as follows, but recieved an error
message that say's "Compile error: Expected variable or procedure, not module"

Private Sub UserList()
Call GetLoggedUsers()
End Sub

-S

"Arvin Meyer [MVP]" wrote:

[Quoted Text]
> Just call it. In code:
>
> Call MyFunction()
>
> In the property sheet:
>
> = MyFunction()
> --
> Arvin Meyer, MCP, MVP
> http://www.datastrat.com
> http://www.mvps.org/access
> http://www.accessmvp.com
>
>
> "Scientific" <Scientific[ at ]discussions.microsoft.com> wrote in message
> news:33FCF4E2-6481-4FD7-826D-7DAD62123170[ at ]microsoft.com...
> > Hello all,
> >
> > I want a public function that I can call from any procudure. All it does
> > is
> > display a message. The trouble I'm having is in the call itself. I just
> > want to be able to execute it when needed wherever required.
> >
> > How does one call a function that passes no values?
> >
> > -S
>
>
>
Re: Function Call ?
Scientific 12/13/2008 5:04:00 AM
Arvin,

How do I call a public function from other forms?

-S
"Scientific" wrote:

[Quoted Text]
> Arvin,
>
> I created the following function module:
>
> Public Function ShowMessage()
> MsgBox "Duplicate entries will not be processed."
> End Function
>
> Then, I tried to use it in a sub routine as follows, but recieved an error
> message that say's "Compile error: Expected variable or procedure, not module"
>
> Private Sub UserList()
> Call GetLoggedUsers()
> End Sub
>
> -S
>
> "Arvin Meyer [MVP]" wrote:
>
> > Just call it. In code:
> >
> > Call MyFunction()
> >
> > In the property sheet:
> >
> > = MyFunction()
> > --
> > Arvin Meyer, MCP, MVP
> > http://www.datastrat.com
> > http://www.mvps.org/access
> > http://www.accessmvp.com
> >
> >
> > "Scientific" <Scientific[ at ]discussions.microsoft.com> wrote in message
> > news:33FCF4E2-6481-4FD7-826D-7DAD62123170[ at ]microsoft.com...
> > > Hello all,
> > >
> > > I want a public function that I can call from any procudure. All it does
> > > is
> > > display a message. The trouble I'm having is in the call itself. I just
> > > want to be able to execute it when needed wherever required.
> > >
> > > How does one call a function that passes no values?
> > >
> > > -S
> >
> >
> >
Re: Function Call ?
fredg <fgutkind[ at ]example.invalid> 12/13/2008 5:05:11 AM
On Fri, 12 Dec 2008 20:53:00 -0800, Scientific wrote:

[Quoted Text]
> Arvin,
>
> I created the following function module:
>
> Public Function ShowMessage()
> MsgBox "Duplicate entries will not be processed."
> End Function
>
> Then, I tried to use it in a sub routine as follows, but recieved an error
> message that say's "Compile error: Expected variable or procedure, not module"
>
> Private Sub UserList()
> Call GetLoggedUsers()
> End Sub
>
> -S
>
> "Arvin Meyer [MVP]" wrote:
>
>> Just call it. In code:
>>
>> Call MyFunction()
>>
>> In the property sheet:
>>
>> = MyFunction()
>> --
>> Arvin Meyer, MCP, MVP
>> http://www.datastrat.com
>> http://www.mvps.org/access
>> http://www.accessmvp.com
>>
>> "Scientific" <Scientific[ at ]discussions.microsoft.com> wrote in message
>> news:33FCF4E2-6481-4FD7-826D-7DAD62123170[ at ]microsoft.com...
>>> Hello all,
>>>
>>> I want a public function that I can call from any procudure. All it does
>>> is
>>> display a message. The trouble I'm having is in the call itself. I just
>>> want to be able to execute it when needed wherever required.
>>>
>>> How does one call a function that passes no values?
>>>
>>> -S
>>
>>

The function name is ShowMessage.
That's what you have to call, not GetLoggedUsers()

Private Sub UserList()
Call ShowMessage
End Sub

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Re: Function Call ?
Scientific 12/13/2008 5:20:04 AM
fredg,

Duh, I forgot to update the name change. Thanks fredg, it works now. And
thank you too Arvin. I love you folks :-)

-S

"fredg" wrote:

[Quoted Text]
> On Fri, 12 Dec 2008 20:53:00 -0800, Scientific wrote:
>
> > Arvin,
> >
> > I created the following function module:
> >
> > Public Function ShowMessage()
> > MsgBox "Duplicate entries will not be processed."
> > End Function
> >
> > Then, I tried to use it in a sub routine as follows, but recieved an error
> > message that say's "Compile error: Expected variable or procedure, not module"
> >
> > Private Sub UserList()
> > Call GetLoggedUsers()
> > End Sub
> >
> > -S
> >
> > "Arvin Meyer [MVP]" wrote:
> >
> >> Just call it. In code:
> >>
> >> Call MyFunction()
> >>
> >> In the property sheet:
> >>
> >> = MyFunction()
> >> --
> >> Arvin Meyer, MCP, MVP
> >> http://www.datastrat.com
> >> http://www.mvps.org/access
> >> http://www.accessmvp.com
> >>
> >> "Scientific" <Scientific[ at ]discussions.microsoft.com> wrote in message
> >> news:33FCF4E2-6481-4FD7-826D-7DAD62123170[ at ]microsoft.com...
> >>> Hello all,
> >>>
> >>> I want a public function that I can call from any procudure. All it does
> >>> is
> >>> display a message. The trouble I'm having is in the call itself. I just
> >>> want to be able to execute it when needed wherever required.
> >>>
> >>> How does one call a function that passes no values?
> >>>
> >>> -S
> >>
> >>
>
> The function name is ShowMessage.
> That's what you have to call, not GetLoggedUsers()
>
> Private Sub UserList()
> Call ShowMessage
> End Sub
>
> --
> Fred
> Please respond only to this newsgroup.
> I do not reply to personal e-mail
>
Re: Function Call ?
Scientific 12/13/2008 12:05:01 PM
Arvin, fredg,

Just wanted you to know I'm having loads of fun with functions now because
they make more sense and are really cool. As you can see it's the middle of
the night and I'm wide awake working with Access, can't leave it alone since
you helped me out. I think the two of you helped in creating an Access
monster and I'm very grateful for it :-)

I owe you!

-S

"Arvin Meyer [MVP]" wrote:

[Quoted Text]
> Just call it. In code:
>
> Call MyFunction()
>
> In the property sheet:
>
> = MyFunction()
> --
> Arvin Meyer, MCP, MVP
> http://www.datastrat.com
> http://www.mvps.org/access
> http://www.accessmvp.com
>
>
> "Scientific" <Scientific[ at ]discussions.microsoft.com> wrote in message
> news:33FCF4E2-6481-4FD7-826D-7DAD62123170[ at ]microsoft.com...
> > Hello all,
> >
> > I want a public function that I can call from any procudure. All it does
> > is
> > display a message. The trouble I'm having is in the call itself. I just
> > want to be able to execute it when needed wherever required.
> >
> > How does one call a function that passes no values?
> >
> > -S
>
>
>
Re: Function Call ?
"Arvin Meyer [MVP]" <arvinm[ at ]mvps.invalid> 12/14/2008 6:40:26 PM
You cannot name a module, the same as a function. Name the module:

basMyFunctions

or basUtilities

or even modUtilities.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"Scientific" <Scientific[ at ]discussions.microsoft.com> wrote in message
news:50F79405-6687-4593-BE4C-830319C94916[ at ]microsoft.com...
[Quoted Text]
> Arvin,
>
> I created the following function module:
>
> Public Function ShowMessage()
> MsgBox "Duplicate entries will not be processed."
> End Function
>
> Then, I tried to use it in a sub routine as follows, but recieved an error
> message that say's "Compile error: Expected variable or procedure, not
> module"
>
> Private Sub UserList()
> Call GetLoggedUsers()
> End Sub
>
> -S
>
> "Arvin Meyer [MVP]" wrote:
>
>> Just call it. In code:
>>
>> Call MyFunction()
>>
>> In the property sheet:
>>
>> = MyFunction()
>> --
>> Arvin Meyer, MCP, MVP
>> http://www.datastrat.com
>> http://www.mvps.org/access
>> http://www.accessmvp.com
>>
>>
>> "Scientific" <Scientific[ at ]discussions.microsoft.com> wrote in message
>> news:33FCF4E2-6481-4FD7-826D-7DAD62123170[ at ]microsoft.com...
>> > Hello all,
>> >
>> > I want a public function that I can call from any procudure. All it
>> > does
>> > is
>> > display a message. The trouble I'm having is in the call itself. I
>> > just
>> > want to be able to execute it when needed wherever required.
>> >
>> > How does one call a function that passes no values?
>> >
>> > -S
>>
>>
>>


Re: Function Call ?
Scientific 12/15/2008 8:51:01 AM
Arvin,

Thanks a million for leading me in the right direction. Your guidance never
goes without great appreciation :-)

-S

"Arvin Meyer [MVP]" wrote:

[Quoted Text]
> You cannot name a module, the same as a function. Name the module:
>
> basMyFunctions
>
> or basUtilities
>
> or even modUtilities.
> --
> Arvin Meyer, MCP, MVP
> http://www.datastrat.com
> http://www.mvps.org/access
> http://www.accessmvp.com
>
>
> "Scientific" <Scientific[ at ]discussions.microsoft.com> wrote in message
> news:50F79405-6687-4593-BE4C-830319C94916[ at ]microsoft.com...
> > Arvin,
> >
> > I created the following function module:
> >
> > Public Function ShowMessage()
> > MsgBox "Duplicate entries will not be processed."
> > End Function
> >
> > Then, I tried to use it in a sub routine as follows, but recieved an error
> > message that say's "Compile error: Expected variable or procedure, not
> > module"
> >
> > Private Sub UserList()
> > Call GetLoggedUsers()
> > End Sub
> >
> > -S
> >
> > "Arvin Meyer [MVP]" wrote:
> >
> >> Just call it. In code:
> >>
> >> Call MyFunction()
> >>
> >> In the property sheet:
> >>
> >> = MyFunction()
> >> --
> >> Arvin Meyer, MCP, MVP
> >> http://www.datastrat.com
> >> http://www.mvps.org/access
> >> http://www.accessmvp.com
> >>
> >>
> >> "Scientific" <Scientific[ at ]discussions.microsoft.com> wrote in message
> >> news:33FCF4E2-6481-4FD7-826D-7DAD62123170[ at ]microsoft.com...
> >> > Hello all,
> >> >
> >> > I want a public function that I can call from any procudure. All it
> >> > does
> >> > is
> >> > display a message. The trouble I'm having is in the call itself. I
> >> > just
> >> > want to be able to execute it when needed wherever required.
> >> >
> >> > How does one call a function that passes no values?
> >> >
> >> > -S
> >>
> >>
> >>
>
>
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net