I am using a piece of code that successfully sets the background colour of controls on a form. And i use similar bits of code to set the background colour of required fields etc..
Public Sub colCtrlNorm(frm As Form)
Dim setColour As String
setColour = RGB(252, 252, 252)
Dim ctl As Control
For Each ctl In frm.Controls
With ctl
If ctl.ControlType = acTextBox Or ctl.ControlType = acComboBox Or ctl.ControlType = acListBox Then
ctl.BackColor = setColour
ElseIf ctl.ControlType = acSubform Then
colCtrlNorm frm(ctl.Name).Form
End If
End With
Next ctl
Set ctl = Nothing
End Sub
Everything works fine and dandy except on a form that contains a subform which has nested datasheet.
When trapping the error I get the following error message:
Error 2455: You entered an expression that has an invalid reference to the property Form/Report
I appreciate i cant change the datasheet controls background colour. This problem only arises with nested datasheets. Anyone any ideas as to how I can avoid this?
Thanks in advance for any assistance with this issue.
Cheers Noel