I have a report that has multiple check boxes etc. When a check box is checked, it then makes the check box bold and then bolds the box surround that entire field. Attached is a picture of 'Employed in the Field' being checked and the effects of it.
However, I have a long string of code that seems to be maxed out
For some reason, when the Unknown check box is checked - the code does not highlite the section like it should. All the others work out fine, but this one seems to rebel on me and will not change the backcolor (unknown). Is this too long or what is wrong?
Thanks, John D
However, I have a long string of code that seems to be maxed out
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If [completioncheck] = True Then
completionbox.BorderWidth = 2
completionbox.BackColor = RGB(192, 192, 192)
compbox.BorderWidth = 2
completionother.BackColor = RGB(192, 192, 192)
Else
completionbox.BorderWidth = 1
completionbox.BackColor = RGB(255, 255, 255)
compbox.BorderWidth = 1
completionother.BackColor = RGB(255, 255, 255)
End If
If [empcheck] = True Then
Employedbox.BorderWidth = 2
Employedbox.BackColor = RGB(192, 192, 192)
empbox.BorderWidth = 2
Contact.BackColor = RGB(192, 192, 192)
Employer.BackColor = RGB(192, 192, 192)
Address.BackColor = RGB(192, 192, 192)
City.BackColor = RGB(192, 192, 192)
State.BackColor = RGB(192, 192, 192)
Zip.BackColor = RGB(192, 192, 192)
position.BackColor = RGB(192, 192, 192)
date.BackColor = RGB(192, 192, 192)
telephone.BackColor = RGB(192, 192, 192)
Else
Employedbox.BorderWidth = 1
Employedbox.BackColor = RGB(255, 255, 255)
empbox.BorderWidth = 1
Contact.BackColor = RGB(255, 255, 255)
Employer.BackColor = RGB(255, 255, 255)
Address.BackColor = RGB(255, 255, 255)
Zip.BackColor = RGB(255, 255, 255)
City.BackColor = RGB(255, 255, 255)
State.BackColor = RGB(255, 255, 255)
position.BackColor = RGB(255, 255, 255)
date.BackColor = RGB(255, 255, 255)
telephone.BackColor = RGB(255, 255, 255)
End If
If [educheck] = True Then
conteducationbox.BorderWidth = 2
conteducationbox.BackColor = RGB(192, 192, 192)
edubox.BorderWidth = 2
institution.BackColor = RGB(192, 192, 192)
Else
conteducationbox.BorderWidth = 1
conteducationbox.BackColor = RGB(255, 255, 255)
edubox.BorderWidth = 1
institution.BackColor = RGB(255, 255, 255)
End If
If [unavailcheck] = True Then
Gradunavailablebox.BorderWidth = 2
Gradunavailablebox.BackColor = RGB(192, 192, 192)
unavailbox.BorderWidth = 2
unavailableother.BackColor = RGB(192, 192, 192)
Else
Gradunavailablebox.BorderWidth = 1
Gradunavailablebox.BackColor = RGB(255, 255, 255)
unavailbox.BorderWidth = 1
unavailableother.BackColor = RGB(255, 255, 255)
End If
If [unemployedcheck] = True Then
Unknown.BorderWidth = 2
Unknown.BackColor = RGB(192, 192, 192)
unemployedbox.BorderWidth = 2
typeofwork.BackColor = RGB(192, 192, 192)
Else
Unknown.BorderWidth = 1
Unknown.BackColor = RGB(255, 255, 255)
unemployedbox.BorderWidth = 1
typeofwork.BackColor = RGB(255, 255, 255)
End If
If [unknowncheck] = True Then
Unknown.BorderWidth = 2
Unknown.BackColor = RGB(192, 192, 192)
unknownbox.BorderWidth = 2
typeofwork.BackColor = RGB(192, 192, 192)
Else
Unknown.BorderWidth = 1
Unknown.BackColor = RGB(255, 255, 255)
unknownbox.BorderWidth = 1
typeofwork.BackColor = RGB(255, 255, 255)
End If
If [unrelatedcheck] = True Then
Unknown.BorderWidth = 2
Unknown.BackColor = RGB(192, 192, 192)
unrelatedbox.BorderWidth = 2
typeofwork.BackColor = RGB(192, 192, 192)
Else
Unknown.BorderWidth = 1
Unknown.BackColor = RGB(255, 255, 255)
unrelatedbox.BorderWidth = 1
typeofwork.BackColor = RGB(255, 255, 255)
End If
End Sub
For some reason, when the Unknown check box is checked - the code does not highlite the section like it should. All the others work out fine, but this one seems to rebel on me and will not change the backcolor (unknown). Is this too long or what is wrong?
Thanks, John D