Repeating Code

PeteJM

Registered User.
Local time
Today, 01:18
Joined
Oct 31, 2004
Messages
28
Hi all, i wonder if anyone can help. i have been using the following code on my forms.

Dim lngWhite As Long, lngGrey As Long
lngWhite = RGB(255, 255, 255)
lngGrey = RGB(192, 192, 192)


I use this to set background colours of text boxes. The problem is i am finding myself repeating these same pieces of code everytime i need to use them. Is there away i can declare these values so i can call them without having to add them to each section.

I hope this is clear.

Regards

Pete
 
Put them at the top of a Standard Module as Constants:

Option Compare Database
Option Explicit
Const lngWhite As Long = RGB(255, 255, 255)
Const lngGrey As Long = RGB(192, 192, 192)
 
i wonder if using vbWhite and vbGrey will do what you want as well (these are predefined colours for things like textbox backgrounds etc)
 

Users who are viewing this thread

Back
Top Bottom