I have a report with a lot of criteria and shading.
I have 3 fields (INSTALLER, SJSCITYSTATE, and DELIVERYDATE)on one line that can shrink. The shrinking part is working fine. But I have 2 lines on the side that are visible or not depending on whether all 3 fields have something in them. That also seems to be working.
The tricky part for me is that these fields shade on my report if there is a code in the ENGRLS field. So I have a box that should become visible if only one of the 3 fields is not null and the ENGRLS date has one of 3 codes (PR, RC, or X). This should make the whole line shade. Sometimes the box is there even when all 3 fields are null, defeating the purpose of shrinking the line. I just can't seem to get the if..then statements to all work together. Here's my code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If IsNull(Me.SJSCITYSTATE) And IsNull(Me.DELIVERYDATE) And IsNull(Me.INSTALLER) Then
Me.Line157.Visible = False
Me.Line159.Visible = False
Else
Me.Line157.Visible = True
Me.Line159.Visible = True
End If
'BOX 160, BEHIND FIELDS THAT CAN SHRINK, BECOMES VISIBLE ONLY WHEN ATLEAST ONE OF THE FIELDS HAS INFO IN IT AND
'IT IS RELEASED BY ENGINEERING SO THAT IT SHADES
If Me.ENGRLSCODE = "RC" Or Me.ENGRLSCODE = "PR" Or Me.ENGRLSCODE = "X" And IsNull(Me.DELIVERYDATE) = False Then
Me.Box160.Visible = True
ElseIf Me.ENGRLSCODE = "RC" Or Me.ENGRLSCODE = "PR" Or Me.ENGRLSCODE = "X" And IsNull(Me.SJSCITYSTATE) = False Then
Me.Box160.Visible = True
ElseIf Me.ENGRLSCODE = "RC" Or Me.ENGRLSCODE = "PR" Or Me.ENGRLSCODE = "X" And IsNull(Me.INSTALLER) = False Then
Me.Box160.Visible = True
Else
Me.Box160.Visible = False
End If
'SHADE FIELDS IN THE DETAIL IF A JOB HAS BEEN RELEASED BY ENGINEERING
If Me.ENGRLSCODE = "RC" Or Me.ENGRLSCODE = "PR" Or Me.ENGRLSCODE = "X" Then
Me.DESCRIPTION.BackColor = 12632256
Me.DELIVERYDATE.BackColor = 12632256
Me.SJSCITYSTATE.BackColor = 12632256
Me.INSTALLATION_NOTES.BackColor = 12632256
Me.INSTALLER.BackColor = 12632256
Me.NEEDELEVATIONS.BackColor = 12632256
Me.APPROVALS.BackColor = 12632256
Else
Me.DESCRIPTION.BackColor = 16777215
Me.DELIVERYDATE.BackColor = 16777215
Me.SJSCITYSTATE.BackColor = 16777215
Me.INSTALLATION_NOTES.BackColor = 16777215
Me.INSTALLER.BackColor = 16777215
Me.NEEDELEVATIONS.BackColor = 16777215
Me.APPROVALS.BackColor = 16777215
End If
End Sub
I have 3 fields (INSTALLER, SJSCITYSTATE, and DELIVERYDATE)on one line that can shrink. The shrinking part is working fine. But I have 2 lines on the side that are visible or not depending on whether all 3 fields have something in them. That also seems to be working.
The tricky part for me is that these fields shade on my report if there is a code in the ENGRLS field. So I have a box that should become visible if only one of the 3 fields is not null and the ENGRLS date has one of 3 codes (PR, RC, or X). This should make the whole line shade. Sometimes the box is there even when all 3 fields are null, defeating the purpose of shrinking the line. I just can't seem to get the if..then statements to all work together. Here's my code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If IsNull(Me.SJSCITYSTATE) And IsNull(Me.DELIVERYDATE) And IsNull(Me.INSTALLER) Then
Me.Line157.Visible = False
Me.Line159.Visible = False
Else
Me.Line157.Visible = True
Me.Line159.Visible = True
End If
'BOX 160, BEHIND FIELDS THAT CAN SHRINK, BECOMES VISIBLE ONLY WHEN ATLEAST ONE OF THE FIELDS HAS INFO IN IT AND
'IT IS RELEASED BY ENGINEERING SO THAT IT SHADES
If Me.ENGRLSCODE = "RC" Or Me.ENGRLSCODE = "PR" Or Me.ENGRLSCODE = "X" And IsNull(Me.DELIVERYDATE) = False Then
Me.Box160.Visible = True
ElseIf Me.ENGRLSCODE = "RC" Or Me.ENGRLSCODE = "PR" Or Me.ENGRLSCODE = "X" And IsNull(Me.SJSCITYSTATE) = False Then
Me.Box160.Visible = True
ElseIf Me.ENGRLSCODE = "RC" Or Me.ENGRLSCODE = "PR" Or Me.ENGRLSCODE = "X" And IsNull(Me.INSTALLER) = False Then
Me.Box160.Visible = True
Else
Me.Box160.Visible = False
End If
'SHADE FIELDS IN THE DETAIL IF A JOB HAS BEEN RELEASED BY ENGINEERING
If Me.ENGRLSCODE = "RC" Or Me.ENGRLSCODE = "PR" Or Me.ENGRLSCODE = "X" Then
Me.DESCRIPTION.BackColor = 12632256
Me.DELIVERYDATE.BackColor = 12632256
Me.SJSCITYSTATE.BackColor = 12632256
Me.INSTALLATION_NOTES.BackColor = 12632256
Me.INSTALLER.BackColor = 12632256
Me.NEEDELEVATIONS.BackColor = 12632256
Me.APPROVALS.BackColor = 12632256
Else
Me.DESCRIPTION.BackColor = 16777215
Me.DELIVERYDATE.BackColor = 16777215
Me.SJSCITYSTATE.BackColor = 16777215
Me.INSTALLATION_NOTES.BackColor = 16777215
Me.INSTALLER.BackColor = 16777215
Me.NEEDELEVATIONS.BackColor = 16777215
Me.APPROVALS.BackColor = 16777215
End If
End Sub