ACC2000: Option Explicit Does Not Appear in New Modules by DefaultID: Q225878
|
When you create a new module in Microsoft Access 2000, Option Explicit does not appear in the Declarations section of the module. By default, only the following line appears in new modules:
Option Compare Database
Option Compare Database
Option Explicit
All Microsoft Office 2000 applications share the same interface for editing Visual Basic for Applications code. The Visual Basic Editor is a new interface for editing Visual Basic for Applications code in Access 2000. The editor uses the same default settings as Microsoft Visual Basic and earlier versions of other Microsoft Office applications that used the editor.
In order to have Option Explicit automatically inserted into new modules, turn on the Require Variable Declaration option in the editor.
Existing modules are not effected by the Require Variable Declaration setting.
Visual Basic for Applications does not automatically require that you explicitly declare a variable before using it in a procedure. If you use a variable that has not been explicitly declared, Visual Basic for Applications implicitly declares it as a variable with the Variant data type. Although implicit declarations are convenient, they can lead to subtle errors in your code.
Use Option Explicit to avoid incorrectly typing the name of an existing variable or to avoid confusion in code where the scope of the variable is not clear.
Additional query words: pra prb
Keywords : kbprg kbdta
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: June 1, 1999