Subs vs Functions 
Author Message
 Subs vs Functions

I have several Subs defined in my dbase. I can't run
these using macros or the 'on click' function of a form
button. What's with that? I believe I have to change
these Subs to Functions. What will this affect?
Perfomance? Anything?  


Mon, 05 Sep 2005 07:36:39 GMT  
 Subs vs Functions
On Wed, 19 Mar 2003 15:36:39 -0800, "Peter Hamilton"

Quote:

>I have several Subs defined in my dbase. I can't run
>these using macros or the 'on click' function of a form
>button. What's with that? I believe I have to change
>these Subs to Functions. What will this affect?
>Perfomance? Anything?  

Subs and Functions differ only in that:

- a Function returns a value, and a Sub doesn't (you can ignore the
returned value if you want

- Only a Function can be executed in a Event property, by putting

=FunctionName(parameters)

in the event. Note that Access provides automatic Subs - if you select
a click event and choose Code Builder, Access will put

[Event Procedure]

in the property and generate a Sub/End Sub pair of lines in the form's
module. Within that Sub you can call another sub, or execute a
function.

There is no performance difference to my knowledge.

                  John W. Vinson[MVP]    
    Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public



Mon, 05 Sep 2005 08:48:20 GMT  
 Subs vs Functions
It would seem much more likely that you do not have a
correct reference ticked. Check your references.
Quote:
>-----Original Message-----
>I have several Subs defined in my dbase. I can't run
>these using macros or the 'on click' function of a form
>button. What's with that? I believe I have to change
>these Subs to Functions. What will this affect?
>Perfomance? Anything?  
>.



Tue, 06 Sep 2005 22:12:14 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. sub Vs function

2. Sub vs Function

3. Sub vs Function

4. Sub vs Function

5. Calling a sub or function using a variable through another sub or function

6. Returning sub or function name within a specific sub or function

7. Local function/sub inside function/sub

8. Function vs. Sub -- when/how to use

9. VS Setting for Sub/Function Show expanded?

10. Properties vs Sub/Function

11. functions vs. subs

12. Function vs. Sub

 

 
Powered by phpBB® Forum Software