[AccessD] How explicit do you need to be?

jwcolby jwcolby at colbyconsulting.com
Mon May 3 06:54:31 CDT 2010


It doesn't matter that much except...

Every once in a while Access will suddenly fail because of the wrong method of reference.

I always use ! to reference controls and . to reference properties.

I suspect that using the wrong syntax slows down the first compile as the compiler has to straighten 
out the mess.

And as Jim mentioned, specify the object lib for things like dao and ado objects.

OTOH you can get in trouble referencing the object lib for things like office applications because 
the lib (and thus the reference) is VERSION SPECIFIC.  You are referencing exactly the version of 
Excel that is on the machine you develop on.  If the app runs on a machine with a different version 
the code will fail.

That is when you get comfortable with early and late binding, as well as compiler directives which 
will allow you to branch your code for early and late binding based on a compiler constant.

http://visualbasic.freetutes.com/learn-vb6-advanced/lesson20/p20.html

John W. Colby
www.ColbyConsulting.com


Darryl Collins wrote:
> _______________________________________________________________________________________
> 
> Note: This e-mail is subject to the disclaimer contained at the bottom of this message.
> _______________________________________________________________________________________
> 
> 
> Hi Folks,
> 
> Finally back on the list after changing roles.
> Curious about this.
> 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?
> For example what are the advantages and/risk of using the following syntax
> 
> x = txtMyTextBox  VS  x = me.txtMyTextBox.value
> 
> Or
> 
> txtFarm.Visible = False
> lblFarm.Visible = False
> txtHire.Visible = True
> lblHire.Visible = True
> 
> VS
> 
> With me
>         .txtFarm.Visible = False
>         .lblFarm.Visible = False
>         .txtHire.Visible = True
>        .lblHire.Visible = True
> End with
> 
> I would normally always use the longer syntax, although for typing reasons I can see the appeal of the shorter style.  In the case of the first example, I guess the .value is the default so that is probably redundant, although I like the way it is clear exactly what it is you are looking at/for.
> 
> So what would be considered 'best (or better) practice' with coding for this example?  Or more importantly, which style will return the results faster and reliably?
> 
> Cheers
> Darryl.
> 
> _____________________________________
> 
> Darryl Collins | Database Developer
> Insurance Australia Group
> + 61 3 9916 3926 (Desk)
> + 61 418 381 548 (Mobile)
> 
> 
> 
> _______________________________________________________________________________________
> 
> 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.
> _______________________________________________________________________________________



More information about the AccessD mailing list