Function Call ?

S

Scientific

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
 
A

Arvin Meyer [MVP]

Just call it. In code:

Call MyFunction()

In the property sheet:

= MyFunction()
 
S

Scientific

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
 
F

fredg

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

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

Private Sub UserList()
Call ShowMessage
End Sub
 
S

Scientific

fredg,

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

-S
 
S

Scientific

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
 
S

Scientific

Arvin,

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

-S
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top