BaldyWeb

Adding Option Explicit to Your Code

A helpful option available in VBA is adding Option Explicit to the top of every module.  With the default of Option Compare Database that is normally there, it would look like:

Option Compare Database
Option Explicit

With that option set, Access forces you to declare any variables you use in your code.  It helps protect you from declaring one variable and using another, due to spelling errors or whatever. 

To have Access automatically add that to every new module, check the box titled "Require Variable Declaration" in Tools Options (in the VBA editor):

 

Home