You can use the following, and simply place it in a standard module.
Option Compare Database
Option Explicit
Public Const OneDozen As Integer = 12
A standard module is a module that you create in the "modules" tab in
ms-access. There is also what is called class modules, and you can make
those by going:
insert->Class module.
however, you do NOT want to use a class module.
In addition, there is also a module associated with EACH form that you make.
Again, you do NOT want to use the forms module, as they go out of scope, and
thus again the constant would not be available.
So, simply create a standard module (or user one of your existing), and put
the constant in that module.
Then, all code can use this constant.
Do note, that forms, and reports controls and sql expressions will NOT be
able to use this constant, but any code you write will be able to...
You can trick, or make expressions in sql, or controls also see the
constant, and you do this by placing a PUBLIC function in a standard module.
Public Function MyDozen() as integer
MyDozen = 12
End function
So, public functions placed in a standard module can be used in expressions,
and also in controls (and, in addition of course be used everywhere in code
like constants can also).
if I defined the above function, then I can put a control text box on a
form, and go;
=([qty] * MyDozen())
The above will work, where as I can't use the constant I define in the above
expression:
= ([qty] * OneDozen)
So, constants, and variables for that matter can't be used in controls
expressions, but functions can. However, both functions, and constants can
be used in VBA code expressions everywhere...