Hi All,

I have the following code to generate a report in my app: Once a user clicks a company on a listview the populate report sub is called. I pass the companyid to the report sub and use that as the recordselectionformula.

my sql query in designer for the report.

the user wants the option to clear a follow up date field on the report once the print button is clicked. I no crystal has an event which is fired once the print button on the crsytalviewer is clicked. How can I allow for a certain field to be either included or excluded. Please help.

I am using CR XI.

Code:
Public Sub lvwCompany_Click()

If (lvwCompany.ListItems.Count > 0) Then

    CoNum = CInt(lvwCompany.SelectedItem.Text)

End If

If (CoNum > 0) Then
    Call LoadContacts(CoNum)

    Call PopRep("({Command.ipkcompanyid} = " & CoNum & ")")
    CrystalActiveXReportViewer1.Visible = True
    
    cmdAddContact.Enabled = True
    cmdAddCall.Enabled = True
End If

End Sub
Code:
Sub PopRep(FilterSql)


    lvwCompany.Enabled = False

    Set oReport = New CrystalReport1
    oReport.EnableParameterPrompting = False
    oReport.DiscardSavedData
    oReport.FormulaSyntax = 0
    oReport.RecordSelectionFormula = FilterSql


    CrystalActiveXReportViewer1.ReportSource = oReport
    CrystalActiveXReportViewer1.ViewReport


    Delay 2 'give report time to load otherwise it fails if user clicks on listview twice while reportviewer is loading

   lvwCompany.Enabled = True

   Set oReport = Nothing

End Sub