Team LiB
Previous Section Next Section

Intrinsic Constants

Variables and constants both represent particular values. However, a variable’s value will change as circumstances dictate, but a constant will always retain the same value. As an example, the value of pi would certainly not change.

You declare a variable with the keyword Dim, and a constant with the keyword Const. There are also constants called intrinsic constants that are built into Access, VBA, or the ADO library. The origin of these intrinsic constants can be identified by their prefix. For example:

VBA has hundreds of such constants built in. As an example, open the Object Browser and do a search for constants. Then, click on one of the VBA libraries. You will get something resembling Figure 8-1. These constants should work properly anywhere in your code.

Click To expand
Figure 8-1: VBA constants

Again, if you use the Object Browser and click on one of the Access libraries, you will get something that looks like Figure 8-2. Before version 2000 of Access, these names used the convention of the letter A followed by an underscore, for example, A_Next or A_ Record.

Click To expand
Figure 8-2: Access constants

We will be exploring ADO constants as we progress further through the book.


Team LiB
Previous Section Next Section