Defining global constants?

jobro

Registered User.
Local time
Today, 15:09
Joined
Nov 3, 2007
Messages
21
So I have a set of colors and font names I must rely on when displaying my forms. I know how to create a form and how to asign new colors to a component, but defining these global constants, how do I do that?
 
Here is an example

Public Const MY_NUMBER = 2

Put this in a module. I use a module for constants only, called basConstants
 
If you want to use this on multiple forms, it must go into a GENERAL module, not a class module. I've done the same thing many times. In fact, I went so far as to export the text of the module so I could re-use it in other Access projects.

Here is an example of what I used. My convention was "VL" in the name for "Very Light" and "Lt" for "Light." I also had "Dk" for "Dark" and "VD" for "Very Dark" - plus no prefix at all for the saturated versions of the colors. Plus I had a couple of favorites for things like "flame orange" and "chartreuse" and similar color mixes.

Code:
Public Const clrVLBlue As Long = &HFFEEEE        'FF for Blue, EE for red and green
Public Const clrVLGreen As Long = &HEEFFEE       'FF for green, EE for red and blue
Public Const clrVLYellow As Long = &HEEFFFF      'FF for red and green, EE for blue
Public Const clrVLGray As Long = &HEEEEEE        'EE for everything
Public Const clrVLMagenta As Long = &HFFEEFF     'FF for red and blue, EE for green
Public Const clrVLRed As Long = &HEEEEFF         'FF for red, EE for blue and green
Public Const clrVLCyan As Long = &HFFFFEE        'FF for blue and green, EE for red

Public Const clrLtBlue As Long = &HFFCCCC        'FF for Blue, CC for Red, Green
Public Const clrLtGreen As Long = &HCCFFCC       'FF for Green, CC for Red, Blue
Public Const clrLtYellow As Long = &HCCFFFF      'FF for Green, Red, CC for Blue
Public Const clrLtGray As Long = &HCCCCCC        'CC for Red, Green, Blue
Public Const clrLtMagenta As Long = &HFFCCFF     'FF for Red, Blue, CC for Green
Public Const clrLtRed As Long = &HCCCCFF         'FF for Red, CC for Blue, Green
Public Const clrLtCyan As Long = &HFFFFCC        'FF for Green, Blue, CC for Red

Public Const clrMidGreen As Long = &H8800        '88 for green, 00 for Red, Blue
Public Const clrMidRed As Long = &H88            '88 for red, 00 for green, blue
Public Const clrMidBlue As Long = &H880000       '88 for blue, 00 for red, green
Public Const clrMidCyan As Long = &H888800       '88 for blue, green, 00 for red
Public Const clrMidYellow As Long = &H8888       '88 for red, green, 00 for blue
Public Const clrMidMagenta As Long = &H880088    '88 for red, blue, 00 for green
Public Const clrMidGray As Long = &H888888       '88 for red, blue, and green
 

Users who are viewing this thread

Back
Top Bottom