Darryl Collins
Darryl.Collins at iag.com.au
Mon May 3 18:42:42 CDT 2010
_______________________________________________________________________________________ Note: This e-mail is subject to the disclaimer contained at the bottom of this message. _______________________________________________________________________________________ Many thanks to everyone for their comments and thoughts. As usual I learnt more than I was expecting too. It is good to be back on the list again as I learn heaps from just reading and lurking. Cheers Darryl. -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kenneth Ismert Sent: Tuesday, 4 May 2010 4:56 AM To: accessd at databaseadvisors.com Subject: Re: [AccessD] How explicit do you need to be? Hi all, Comments inline: Darryl Collins: > ...Personally I have always been very precise with references etc as it > seems to improve performance and reliability. However, does it really > matter that much? > ... > x = txtMyTextBox VS x = me.txtMyTextBox.value > ... > It doesn't matter at all when you are referencing controls within a form module. But, other languages enforce the use of "this" to refer to the current object instance, so using "me" seems like good practice. As you mentioned, me also leverages Intellisense. Jim Dettman: > ...When you do this: > With me > .txtFarm.Visible = False > End with > VBA knows for sure that it's really: > me.txtFarm.Visible = False > VBA knows for sure in with or without the me. Just plain txtFarm.Visible is early-bound, too. Try misspelling a plain txtFarm reference, and see what VBA does. > ... I also do things like: > Dim db as DAO.Database > Rather then: > Dim db as Database > ...Well first, I don't know if or when I might add ADO to a project, so > it's > good to have them on. That is a valid reason to specify the type library. > Second it's faster because VBA knows exactly which > lib reference I mean. > Not at runtime. Both are early-bound references, and both run equally fast. It might be a tiny bit faster to compile, but that is negligible. The real reason to specify type is your first reason. jwcolby: > ... I always use ! to reference controls and . to reference properties. > That's fine, but ! references are always late-bound. So, if you have a control called txtExample, and refer to it as me!txtWrongName, your project will compile just fine, and you'll only get an error at runtime when VBA tries to resolve the reference. That's why I prefer . for control references, and only use ! for recordset fields. -Ken -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com _______________________________________________________________________________________ The information transmitted in this message and its attachments (if any) is intended only for the person or entity to which it is addressed. The message may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon this information, by persons or entities other than the intended recipient is prohibited. If you have received this in error, please contact the sender and delete this e-mail and associated material from any computer. The intended recipient of this e-mail may only use, reproduce, disclose or distribute the information contained in this e-mail and any attached files, with the permission of the sender. This message has been scanned for viruses. _______________________________________________________________________________________