Appendix H. Reserved Words and Special Characters

There are numerous words that should not be used to name fields, objects, and variables. For the most part, these are called reserved words. Reserved words have a specific meaning to Microsoft Access, the Microsoft Jet database engine, or in conjunction with SQL Server or ODBC drivers. It may be easy to start a list of reserved words by thinking of the list of all the properties of database objects, all Visual Basic keywords, and all third-party and user-defined names and functions.

Using reserved words often creates error messages that do not indicate the source of the problem. For example, it is far from intuitive that the error message "The wizard was unable to preview your report, possibly because a table needed by your report is exclusively locked" was triggered by the use of a reserved word. Consequently, a developer may spend time troubleshooting and going down the wrong path. So in an application that uses reserved words, if it is at all possible and feasible, rename database objects—particularly tables and fields—which use reserved words. If it is not possible or practical to rename the offending object, then be sure to enclose the names in brackets when they are called in code. The following example shows the name of the table in brackets because the term tableName is a reserved word.

SELECT fieldX
FROM [tableName]

When writing code, it is often handy to use the IntelliSense feature and just select from the available ...

Get Access 2003 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.