1
votes

I use crystal reports in my project (Frontend:Visual Basic and Backend:SQL). I mail the report (which is a Request for Quotation Report) to vendors attached as an .rpt file through Microsoft Outlook.

However once I send a saved .rpt file to Vendor A, the report file doesn't get refreshed or updated when sent to Vendor B and so forth. Vendor B gets a copy of the report filled with Vendor A's data.

How can I refresh the .rpt file through VB code itself?

2

2 Answers

2
votes

As it seems that the report is different for each vendor, you'll have to recreate it for each of them. So you could just delete the old RPT file after sending the email and before recreating the report for the next vendor. This should make sure that you have correct data in every report.

1
votes

Suppose your report Object is rptObj and you want to display in CrystalReportViewer1 then use following code on event where your report is generated

    rptObj1.Load()
    rptObj1.Refresh()
    CrystalReportViewer1.ReportSource = rptObj1
    CrystalReportViewer1.RefreshReport()