K.2. Reserved Words with Error Messages

You might wonder why you can't simply use a tool that will check against your custom list of reserved words and give you a timely and specific error message as you are creating your tables and adding fields. Although that seems like a great idea, it wouldn't be easy to implement. The Access team recognizes the merit in the concept, though, and has instituted an automatic check for a limited number of terms that are commonly used in both VBA and as field names. At this time, the list contains only six words:

NameValueText
DateYearMonth

Nonetheless, the seed has been planted, so to speak.

Keep in mind that you might circumvent this built-in check if you are creating a table in code. Access performs the check and generates the appropriate error message when you are creating a new table in the Access UI (see Figure K-2). However, you won't trigger the error if you create a table using CreateTableDef or the CREATE TABLE statement.

Figure K.2. Figure K-2

Get Access™ 2007 VBA Programmer's Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.