[AccessD] A 97 to A 2010 compile error

Jim Dettman jimdettman at verizon.net
Mon May 1 05:26:16 CDT 2017


 There is a slight edge. 

 While the p-code would ultimately be the same, it's one extra step that
Access/VBA does not need to go through when dealing with a reference.

 All references are converted to the paren/quote format before anything else
is done with it.

Jim.

-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
Stuart McLachlan
Sent: Sunday, April 30, 2017 07:28 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] A 97 to A 2010 compile error

I really doubt that Forms("frmTest")("txtName")  will be any different to
Forms![frmTest]![txtName]
when it comes to run time performance.

Both will be converted to exactly the same PCode when the VBA  is compiled.
 
-- 
Stuart

On 30 Apr 2017 at 15:19, Bob Heygood wrote:

> Hello Jim,
> Yes I'm pretty old school and not kept up on the latest Access
> changes. I must have written that code a long time ago. Good advice on
> explicitly stating the hierarchy of elements and their collections.
> Gotta say though I really hate to use any parenthesis in my coding. I
> was traumatized many times by my errors and grew to dislike them a
> lot, especially when concatenating lines.
> 
> Thanks again,
> 
> Bob
> 
> 
> -----Original Message-----
> From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf
> Of Jim Dettman Sent: Saturday, April 29, 2017 5:07 AM To: 'Access
> Developers discussion and problem solving' Subject: Re: [AccessD] A 97
> to A 2010 compile error
> 
> Bob,
> 
>   You'll find reference checking got a lot tighter in A2007 and up and
>   some
> things that you got away with before you can no longer.  A bang (!)
> indicates that what follows is a element of a collection.  A dot (.)
> means a property, collection, or method name.  Also there were some
> changes made with A2000, which is the addition of default collections,
> that has an impact on references.
> 
>   If you can learn to do it, you can always use this syntax:
> 
>     Set ctl = Forms("frmTest")("txtName")
> 
>     before you would do this:
> 
>     Set ctl = Forms![frmTest]![txtName]
> 
>   Behind the scenes, Access actually translates all your statements to
>   this
> format of parentheses and quotes, so if you use it, there is a bit of
> a performance edge.
> 
>   The above works because the controls collection is the default
>   collection
> for a form.   Normally in the past, you would have had to do:
> 
>   Set ctl = Forms("frmTest").Controls("txtName")
> 
>   I'm still "old school" and use the bang everywhere as even with the
>   ("")
> syntax, querydef parameters that refer to form controls is one place
> where a bang must be used.   There were a couple of others as well,
> but I've forgotten what they were, and I could never keep them all
> straight, so I continued to use the bang.
> 
> Jim.  
> 
> -----Original Message-----
> From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf
> Of Bob Heygood Sent: Friday, April 28, 2017 05:13 PM To: 'Access
> Developers discussion and problem solving' Subject: [AccessD] A 97 to
> A 2010 compile error
> 
> I am converting an app from A 97 to A 2010.
> I updated the DAO ref already.
> What reference or library am I missing when I get an error :
> Compile Error
> "Method or Data member not found"
> For this line:
> txtTerms_ID = rstTerms.[Terms_ID]
> .[Terms_ID] is highlighted.
> 
> 
> TIA
> Bob
> 
> --
> 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
> 
> -- 
> 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