RacerGirl117
Technical User
I have a report in which I need to hide detail records if the BOQty is less than zero AND the Comments field does not contain the word "Advance". I am stumped on how to do this in the most efficient manner. Right now if the BOQty field is not equal to zero, it displays the detail record regardless of the value of the Comments field. For this particular report the only time we need to see negative BOQty values is if the item is an advance replacement (which means the Comments field will contain the word "advance"
. Does that make any sense? Can anyone offer any suggestions?
The code I currently have is as follows:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
' Make Comments visible if it contains the word "Advance"
Comments.Visible = (Left$(Comments & " ", 7) = "Advance"
' Decide which value to display in the BOQty field
If IsNull(BOQty) Then
BOQty = Nz(Eng_Qty) - Nz(SumOfQty_Shipped)
End If
'Make Detail invisible (if BOQty is greater than zero)
Detail.Visible = Nz(BOQty, 0) > 0
End Sub
Private Sub GroupFooter1_Format(Cancel As Integer, FormatCount As Integer)
'Determine the BOQtyTotal
If IsNull(BOQtyTotal) Then
BOQtyTotal = Nz(EngQtyTotal, 0) - Nz(QtyShippedTotal, 0)
End If
'Hide the Group Footer if BOQtyTotal = zero
If BOQtyTotal > 0 Then
GroupFooter1.Visible = True
Else
GroupFooter1.Visible = False
End If
End Sub
Keep in mind that I'm pretty new to this VBA thing, so some of my code may be a bit barbaric by some standards.
Jessica Morgan
Fire Fighter Sales & Service Co.
Pittsburgh, PA
The code I currently have is as follows:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
' Make Comments visible if it contains the word "Advance"
Comments.Visible = (Left$(Comments & " ", 7) = "Advance"
' Decide which value to display in the BOQty field
If IsNull(BOQty) Then
BOQty = Nz(Eng_Qty) - Nz(SumOfQty_Shipped)
End If
'Make Detail invisible (if BOQty is greater than zero)
Detail.Visible = Nz(BOQty, 0) > 0
End Sub
Private Sub GroupFooter1_Format(Cancel As Integer, FormatCount As Integer)
'Determine the BOQtyTotal
If IsNull(BOQtyTotal) Then
BOQtyTotal = Nz(EngQtyTotal, 0) - Nz(QtyShippedTotal, 0)
End If
'Hide the Group Footer if BOQtyTotal = zero
If BOQtyTotal > 0 Then
GroupFooter1.Visible = True
Else
GroupFooter1.Visible = False
End If
End Sub
Keep in mind that I'm pretty new to this VBA thing, so some of my code may be a bit barbaric by some standards.
Jessica Morgan
Fire Fighter Sales & Service Co.
Pittsburgh, PA