- Local time
- Today, 12:11
- Joined
- Feb 19, 2002
- Messages
- 45,760
My ORIGINAL post, all the way back at #3 suggested a function might work. The OP wasn't buying and everyone else is suggesting that VBA will work.
Can you do something like this where you paste a single textbox behind the data textboxes and make their background transparent.
View attachment 100692
I would have thought the same thing. But does not appear to be the methods or way to do this.When setting format conditions manually you can highlight several controls and the condition will then say "multiple". is there a way of doing that with the code you wrote
Set con = Me.CatID.FormatConditions.Add(acFieldValue, acEqual, "'" & category & "'")
With con
.BackColor = RGB(r, g, b)
End With
Private Sub Detail_Paint()
Me.Text50.BackColor = RGB(Rnd() * 255, Rnd * 255, Rnd * 255)
End Sub
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