Private Sub Detail_Paint()
Me.FldOne.BackColor = GetColor(Me.FldOne)
Me.FldTwo.BackColor = GetColor(Me.FldTwo)
Me.FldThree.BackColor = GetColor(Me.FldThree)
End Sub
Public Function GetColor(Category As Variant) As Long
Dim r As Integer
Dim g As Integer
Dim b As Integer
If Not IsNull(Category) Then
r = DLookup("Red", "tblCategories", "CatID = '" & Category & "'")
g = DLookup("Green", "tblCategories", "CatID = '" & Category & "'")
b = DLookup("Blue", "tblCategories", "CatID = '" & Category & "'")
GetColor = RGB(r, g, b)
Else
GetColor = RGB(255, 255, 255)
End If
End Function
Private Sub FldOne_GotFocus()
FldOne.BackColor = GetColor(Me.FldOne)
End Sub
Private Sub FldTwo_GotFocus()
FldTwo.BackColor = GetColor(Me.FldTwo)
End Sub