Need to change a box colour if chkbox = true

Chimp8471

Registered User.
Local time
Today, 19:21
Joined
Mar 18, 2003
Messages
353
I have a report which i am trying to format, I want every other row's details to alternate colour which i have done (See below)

I also have on my report, a checkbox and a text feild (not sure if i could use a rectangle and format that instead , it doesn't do anything i just need it to change colour)

chkbox name = "chkClean"
Text box name = "txtclean"

I just want the back colour to go red if the check box is true and white if the check box is false

Please help

ANdy

Code:
Option Compare Database
Option Explicit
Private m_RowCount As Long

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
m_RowCount = m_RowCount + 1
    If m_RowCount / 2 = CLng(m_RowCount / 2) Then
            Me.Detail.BackColor = 15263976 'Change value to the color you desire
        Else
            Me.Detail.BackColor = 14811135 'Change value to the color you desire
    End If
If Me.chkClean = True Then
 txtclean.BackColor = 255
Else
 txtclean.BackColor = 16777215
End If
End Sub
 
Ok on your report
you need to go to detail
build events- buidl code or code builder
now the rest should be easy
as its pretty much

If Me.chkClean = True Then
txtclean.BackColor = 255
Else
txtclean.BackColor = 16777215
End If
End Sub

however these need to be the names on the report and might not be the field names

should work

g
 
oops try replacing . with !
not sure why but this seems to work better
 
I would like to change color of check box in a query when selected. Is this possible?
 

Users who are viewing this thread

Back
Top Bottom