[AccessD] A 97 to A 2010 compile error

Bob Heygood accesspro at gmail.com
Sun Apr 30 17:19:00 CDT 2017


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



More information about the AccessD mailing list