Max Wanadoo
max.wanadoo at gmail.com
Tue Feb 24 02:44:35 CST 2009
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