change color of form when more than one record

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that has a subform. There is a RARE possibility that more than
one record will be associated with the subform. I would like the backcolor
of the subform to change to another color if there is more than one record
associated with it (just to bring it to the user's attention that they need
to click the NEXT button to see the other records). What would the code look
like for that?

Thanks
 
This is a quick example that does just that based on NWind.

To get it working add the folowing to the Orders form, and change the
default view of the sub form to "Continuous Form"

Private Sub Form_Current()

If Me.Orders_Subform.Form.RecordsetClone.RecordCount > 1 Then
Me.Orders_Subform.Form.Section(0).BackColor = 255
Else
Me.Orders_Subform.Form.Section(0).BackColor = 16777215
End If

End Sub
 
Back
Top