Reserved Words (1 Viewer)

Mark-BES

Registered User.
Local time
Yesterday, 16:28
Joined
Nov 23, 2004
Messages
85
Hi all,

Does anyone have a definitive list of reserved words in Access? I understand certan words are reserved because they cause a problem when using vba. Is this correct?

It would make sense because I used to have a field called "Name" and my controls never worked correctly. I have since changed this and all is ok.

I have searched Access help files and this forum, but am unable to find a complete list other than the odd one like name, date, group etc.

Any help would be great. Many thanks.
 

Mile-O

Back once again...
Local time
Today, 00:28
Joined
Dec 10, 2002
Messages
11,316
Well, here's the list as cited by Microsoft although I can see a few glaring omissions on their behalf (Day, for example).

Reserved Words in Access 2002 and Access 2003

Reserved Words in Jet 4.0

Reserved Words in Access 2000
Reserved Words in Access 97

The best way to think of reserved words is any word that already has a purpose in Access or Jet. Don't go creating fields named after any function, object, or property. So no Month, Form, or Name respectively. Keywords in VBA are also considered to be reserved words. So don't use any word that can be used in VBA to name fields. That's one of the reasons it's wise to prefix everything you name in Access - so as to avoid conflict with any reserved words.

It gets more complicated when you start adding references to your database. If, for example, you added Microsoft ActiveX Data Objects 2.7 Library (ADO) to your database then every method and property within that also becomes a reserved word.

And, when you add ActiveX controls then all their methods and properties become reserved. For example, you could have a field called Navigate but once you add the Microsoft Internet Explorer ActiveX control then, since Navigate is a method, the word Navigate becomes reserved.

And who know what programmers have named their methods and properties when you start using custom ActiveX controls: confused:

Also, pay attention to the special characters listed at the bottom of the reserved word pages and extend those to be actually any non-alphanumeric character - including spaces - as it's safer in the long run and best practice.
 

Mark-BES

Registered User.
Local time
Yesterday, 16:28
Joined
Nov 23, 2004
Messages
85
SJ McAbney;

Many thanks for that, it will be most useful.

Quote
It gets more complicated when you start adding references to your database. If, for example, you added Microsoft ActiveX Data Objects 2.7 Library (ADO) to your database then every method and property within that also becomes a reserved word.........

Blimey! Maybe I should have asked which words can I use! :)

Thanks again, Your a Star!
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 19:28
Joined
Feb 19, 2002
Messages
43,352
It's not as bad as all that. There is no need to memorize any lists although you should peruse them to get their flavor. Most reserved words will be singular, single words rather than plural or compound words. So - FirstName would be fine because it is two words so is unlikely to ever match a reserved word. Names would also probably be ok because it is plural. If you stick to compound words, you are unlikely to run into problems. Compound in this case includes the prefixes we use for objects and procedure variables such as frm, qry, tbl, txt, str, int, etc.
 

Users who are viewing this thread

Top Bottom