Article ID: 131886
Article Last Modified on 1/19/2007
Option Explicit
Dim SaveForeColor As Single
Dim SaveBackColor As Single
Const MyBackColor = 0
Const MyForeColor = 16777215
Sub SetControlColor (MyControl As Control)
' ******************************************************************
' Sub: SetControlColor
'
' Purpose: This procedure sets the colors of the referenced control.
' ******************************************************************
On Local Error Resume Next
' Save the current control colors.
SaveBackColor = MyControl.BackColor
SaveForeColor = MyControl.ForeColor
' Set the custom colors.
MyControl.BackColor = MyBackColor
MyControl.ForeColor = MyForeColor
End Sub
Sub ReSetControlColor (MyControl As Control)
' ***********************************************************
' Sub: ReSetControlColor
'
' Purpose: This procedure resets the colors of the referenced
' control.
' ***********************************************************
On Local Error Resume Next
' Reset to the saved colors.
MyControl.BackColor = SaveBackColor
MyControl.ForeColor = SaveForeColor
End Sub
Private Sub LastName_Enter ()
Call SetControlColor([LastName])
End Sub
NOTE: In version 2.0, there is a space in the Last Name field name.
Private Sub LastName_Exit (Cancel As Integer)
Call ReSetControlColor([LastName])
End Sub
Additional query words: colour on entry exit original cursor cell how can I to do
Keywords: kbinfo kbprogramming kbusage KB131886