PDA

Click to See Complete Forum and Search --> : refresh a crystal report


engnouna
Jul 7th, 2006, 02:10 AM
Hi
I am using VB6,crystal report 9 and SQL server 2000,I have a command button that displays the report inside crystal report viewer,but every time i need to display a report,the crystal viewer displays to me the last report so i need to press on refresh to view the current report.
I tried in my VB6 code the following code to make the refresh automatic but it didn't work

Rs.Open str2, cnn, adOpenStatic, adLockOptimistic
Set oApp = New CRAXDRT.Application
Set oReport = oApp.OpenReport(App.Path & "\Report2.rpt", 1)
oReport.Database.SetDataSource Rs, 3, 1
crvMyCRViewer.ReportSource = oReport
crvMyCRViewer.ViewReport
crvMyCRViewer.Refresh
Rs.Close

where should I place crvMyCRViewer.Refresh?

thanks

Besoup
Jul 7th, 2006, 08:05 AM
in crystal make sure you aren't saving the data with the report... in CR 11 it is under the File menu.

shakti5385
Jul 18th, 2006, 04:55 AM
CRViewer1.EnableRefreshButton = True

shakti5385
Jul 18th, 2006, 04:57 AM
Rs.Open str2, cnn, adOpenStatic, adLockOptimistic
Set oApp = New CRAXDRT.Application
Set oReport = oApp.OpenReport(App.Path & "\Report2.rpt", 1)
oReport.Database.SetDataSource Rs, 3, 1
CRViewer1.EnableRefreshButton = True
crvMyCRViewer.ReportSource = oReport
crvMyCRViewer.ViewReport
crvMyCRViewer.Refresh
Rs.Close
now refresh the report