Glad to hear the reference is straightened out. Be sure either to remove
any references to ActiveX Data Objects, or be sure the DAO reference is
above them in the References list.
Form another part of this thread:
The syntax to reference a subform control is:
Forms!MainFormName!SubFormControlName.Form!DateOff
From code in the main form (which is what I think you have) you could use:
Me.SubformControlName.Form.DateOff
To reference a property of the subform:
Me.SubformControlName.Form.RecordsetClone
You are correct that there should be a reference to the subform. Actually,
you reference the Form property of the subform control. The subform control
is the "container" for the subform. Just as a text box is the container for
a field, the subform control is the container for a form.
With the names you have listed the code in the main form's Current event
would be:
Me.Splits_Form.Form.RecordsetClone
This is not correct:
If rs("DateOff.backcolor") = vbRed Then
The reason is that rs is a recordset, or a group of records. It does not
have a backcolor property. DateOff is a field in the recordset, which means
it has a value, but no colors or any other physical characteristics. You
need to apply the test you used for conditional formatting (the code that
caused the text box to turn red):
If rs("DateOff") = "something" Then
bLabelVisible = True
You would probably need to set bLabelVisible to False if the test does not
pass. One way to do that is to set it to False before you begin the loop.
That is, at each main form record you start with the assumption that it is
False (no red text boxes in the subform).
bLabelVisible = False
Do While Not rs.EOF
If rs("DateOff") = 'something Then
bLabelVisible = True
Exit Do
End If
etc.
I'll leave you to fill in the rest of the code that Dale provided. Dale, I
didn't mean to hijack the thread. I added what I thought would be a quick
suggestion, and it sort of got carried away.