[AccessD] A 97 to A 2010 compile error

Jim Dettman jimdettman at verizon.net
Sat Apr 29 07:06:55 CDT 2017


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



More information about the AccessD mailing list