Keeping a row from printing


03-09-2010, 4:01 PM
I imagine there should be a simple answer to this but I'm not sure. I have a report and for reason that I won't explain I need to keep from printing records if certain conditions are met ie. print all rows where rpt.Fields("Print").value = "Yes" and otherwise do not show the row. Obviously I can test this condition in the OnDataFetch Event but when the condition is met how can you keep the row from printing?

Thank you

Re: Keeping a row from printing


03-10-2010, 11:16 AM
Hello,

Do you wish to show the report in the viewer but not in the print out? I am afraid there cannot be changes in the report between its run and the print. However you could rerun the report-> set the visible property of the control to false when the condition is met and then print the same.

Regards,
Prantik

Re: Keeping a row from printing


03-11-2010, 10:48 AM
By print I mean display in the viewer. The recordset being used for the record contains more records than I want to display, I managed to eliminate the records by changing the LayoutAction dependent on the field values as it runs through the records. I would have preferred to prefilter the subreport (obviously more efficient) but it was not an option in this case.

Thank you

Re: Keeping a row from printing


03-12-2010, 1:31 PM
Hello,

Are you using this in the code behind or the script? In case it is in the codebehind , you can use something similar to the following

Private Sub Detail_Format ()
If Me.Field1.Text = "k" Then
   Me.Detail.Visible = False
Else
   Me.Detail.Visible = True
End If

End Sub

Or

Private Sub ActiveReport_FetchData (EOF As Boolean)
   If Me. Fields ("k").Value = "k" Then
     Me.Detail.Visible = False
    Else
      Me.Detail.Visible = True
   End If
End Sub

If you are in writing this in the script, replace me with rpt.

Regards,