I have a continuous form set up with text box (called text_1) on it which will either contain a 1 or a 0 (for simplicity sake). I want to change the background colour for the detail section of the form based on whether my text box contains a 1 or a 0. I have found a couple of posts for changing the colour of a text box based on the value in another text box which I've altered to this
Private Sub Form_Open(Cancel As Integer, FormatCount As Integer)
If Me.Checked = "-1" Then
Me.Detail.BackColor = vbRed
Else
Me.Detail.BackColor = vbBlack
End If
but unfortunately I had to guess at the Detail bit as I don't know how to refer to that in code (if it's possible). Can anyone help me out?
I've just had a thought as I've been writing this, I could always put a big text box covering the whole of the detail section behind my other boxes and use the code I've already found to change the colour of that based on the value, which I'll try shortly, but I'd still be interested to find out if my original idea is possible.
Thanks
Private Sub Form_Open(Cancel As Integer, FormatCount As Integer)
If Me.Checked = "-1" Then
Me.Detail.BackColor = vbRed
Else
Me.Detail.BackColor = vbBlack
End If
but unfortunately I had to guess at the Detail bit as I don't know how to refer to that in code (if it's possible). Can anyone help me out?
I've just had a thought as I've been writing this, I could always put a big text box covering the whole of the detail section behind my other boxes and use the code I've already found to change the colour of that based on the value, which I'll try shortly, but I'd still be interested to find out if my original idea is possible.
Thanks