[AccessD] Classes and Events - EVENTS NOT REQUIRED

Tina Norris Fields tinanfields at torchlake.com
Tue Feb 24 07:24:35 CST 2009


Thank you to all who responded.  The comparison to the "void" function 
makes it clear to me.
Tina

Stuart McLachlan wrote:
> Guess it depends on what other languages you are used to
> Many languages don't differentiate.
>
> A Basic SUB is the equivalent of a "Void Function" in many languages.
>
> IMNSHO, It's really a matter of personal preference rather than "best 
> practice"
>
>
> Cheers,
> Stuart
>
> On 24 Feb 2009 at 8:44, Max Wanadoo wrote:
>
>   
>> True, but I think it is bad coding, stuart.
>>
>> A function returns a value.
>> A command carries out an action
>>
>> A function in VBA is a function (!)  Calling it a function indicates in
>> itself that a value is required.
>> A sub in VBA is a command.  Calling it a sub indicates that it is going to
>> do something and then finish.
>>
>> Those who remember back to Ashton Tate and DB, FoxPRo etc will know what I
>> mean!
>>
>> My 2p worth
>>
>> Max
>> Laugh more than cry.  Smile more than frown.  Be generous in  spirit.  And
>> always stand your round in the pub!
>>
>>
>> -----Original Message-----
>> From: accessd-bounces at databaseadvisors.com
>> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of jwcolby
>> Sent: 24 February 2009 01:38
>> To: Access Developers discussion and problem solving
>> Subject: Re: [AccessD] Classes and Events - EVENTS NOT REQUIRED
>>
>> Exactly and exactly.
>>
>> John W. Colby
>> www.ColbyConsulting.com
>>
>>
>> Stuart McLachlan wrote:
>>     
>>> That's the theory.  In practice Functions do not *need* to return a value,
>>>       
>> you can replace 
>>     
>>> "Sub" with "Function" anywhere you like, but you can only replace
>>>       
>> "Function" with "Sub" if 
>>     
>>> there is no return value.  
>>>
>>> I tend to use "Function"  all the time, the only "Sub"s you'll see in my
>>>       
>> apps are the built in 
>>     
>>> events in Forms etc.
>>>
>>> It's also good practice to "type" Functions which do return a value,
>>>       
>> otherwise you have the 
>>     
>>> overhead of converting from/to variants - it also makes it clear whether a
>>>       
>> Function does in 
>>     
>>> fact return a value. Here it would be preferable to use:  "Function
>>>       
>> EndTimer() As Long"
>>     
>> -- 
>> AccessD mailing list
>> AccessD at databaseadvisors.com
>> http://databaseadvisors.com/mailman/listinfo/accessd
>> Website: http://www.databaseadvisors.com
>>
>> -- 
>> AccessD mailing list
>> AccessD at databaseadvisors.com
>> http://databaseadvisors.com/mailman/listinfo/accessd
>> Website: http://www.databaseadvisors.com
>>     
>
>
>   



More information about the AccessD mailing list