O'Reilly logo

Access™ 2007 VBA Programmer's Reference by Armen Stein, Geoffrey Griffith, Rob Cooper, Teresa Hennig

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required