I have the below code in a subform. The code works when I open the subform directly by itself. But it gives me a 2424 or 2450 error when I open the parent form. I've tried a bunch of different ways of referencing the control (cboFinishID) but I keep getting the error message that Access either can't find the form or can't find the control. Why does this work when the subform is opened directly by itself but not when it is opened as part of the parent form?
Code:
Private Sub Detail_Paint()
Dim FIN As Long
If Len(Me.cboFinishID & "") < 1 Then
FIN = 0
Else
FIN = Forms!sfrmLineItemsDE.Form!cboFinishID
End If
If DLookup("HexCode", "qryColors", "FinishID = " & FIN) <> 0 Then
Me.cboFinishID.BackColor = DLookup("HextoRGB", "qryColors", "FinishID = " & Forms!sfrmLineItemsDE.cboFinishID)
Me.cboFinishID.ForeColor = RGB(255, 255, 255)
'MsgBox "RGB is " & Red & ", " & Green & ", " & Blue
Else
Me.cboFinishID.BackColor = RGB(255, 255, 255)
Me.cboFinishID.ForeColor = RGB(0, 0, 0)
End If
End Sub