|
|
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
|
|
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
|
|
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 > > >
|
|
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 > > > > > >
|
|
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
|
|
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 >
|
|
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 > > >
|
|
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 >> >> >>
|
|
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 > >> > >> > >> > > >
|
|
|