Results 1 to 2 of 2

Thread: How to give user an option of clearing a report field once print button is clicked

  1. #1

    Thread Starter
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    How to give user an option of clearing a report field once print button is clicked

    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

  2. #2
    Lively Member
    Join Date
    Sep 2007
    Location
    Texas
    Posts
    98

    Re: How to give user an option of clearing a report field once print button is clicked

    Personally I think it might be easier to do it the other way round. Let the user choose what he wants to see before you run the report.

    That way you can send parameters into the report telling it what fields to suppress/show based on their selection.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width