My Crystal Report only shows the last data until I click the Refresh Data Button. Can I not do that programmatically as the Report loads?
Printable View
My Crystal Report only shows the last data until I click the Refresh Data Button. Can I not do that programmatically as the Report loads?
When you created the report did you uncheck the option to
save data with report?
I may have.
I remade the Report and set that "Save Data With Report" was not checked. However I still dont get my new report showing the current data until I click the Refresh Data button on the Viewer
How are you setting the ReportSource of your report?
This usually works for me to have the report show in the CR
Viewer with initial current data.
HTHVB Code:
Option Explicit 'Add reference to Crystal Reports x.x ActiveX Designer RunTime Library 'Add reference to Crystal Reports Viewer Control 'Add reference to Microsoft ActiveX Data Objects 2.x Library 'oCnn = current open ADO connection object Private Sub Command1_Click() Dim oApp As CRAXDRT.Application Dim oReport As CRAXDRT.Report Dim oRs As ADODB.Recordset Dim sSQL As String sSQL = "SELECT * FROM Table1" Set oRs = New ADODB.Recordset Set oRs = oCnn.Execute(sSQL) Set oApp = New CRAXDRT.Application Set oReport = oApp.OpenReport(App.Path & "\MyReport.rpt", 1) oReport.Database.SetDataSource oRs, 3, 1 crvMyCRViewer.ReportSource = oReport crvMyCRViewer.ViewReport End Sub