Click to See Complete Forum and Search --> : Odd behaviour - Refresh method Viewer control


divined
June 3rd, 2005, 03:06 AM
Hello everybody

I have this problem. I have a form with a Crystal Reports viewer control. I call the form with the viewer control from another form of my application. Now, it might happen that the viewer control loses focus without being closed (MDI app). When focus is restored to that form I refresh the Recordset feeding the report and then call the Refresh method of the viewer control. Here is the code I`m using to initialize the viewer control.


Private Sub LinkViewerToReport()

CrystalReport_listaEtairiwn.Database.SetDataSource rsListaEtairiwn, 3, 1

Set p1 = CrystalReport_listaEtairiwn.ParameterFields.GetItemByName("Title")
p1.AddCurrentValue (rsYphresia.Fields("Yphresia").Value)

CrystalActiveXReportViewer1.ReportSource = CrystalReport_listaEtairiwn

CrystalActiveXReportViewer1.ViewReport
End Sub



Then in the Activate event of the form with the viewer control I run the code :


' Refresh data in query. Refreschieren Sie die data im Grid!
rsListaEtairiwn.Requery

' Refresh Crystal Reports viewer.
CrystalActiveXReportViewer1.Refresh


Unfortunately, when focus is restored to the form, the parameter window pops up and the recordset remains unchanged! Am, I missing something?

thx, in advance

George Papadopoulos