I have build a repor using crystal report. But from my vb application I want to show the newest change for my data. How can I refresh the data if there were any changes ? Thanks
Printable View
I have build a repor using crystal report. But from my vb application I want to show the newest change for my data. How can I refresh the data if there were any changes ? Thanks
hi friend....i am also trying to do the same thing..if u have found any solution just post it to [email protected]
If you are using a Crystal control it's
Other ways of displaying a report will have similar methodsVB Code:
CrystalReport1.DiscardSavedData = True
FW
How about in the form where you have your Viewer add a timer and then refresh the report using the method of the CRViewer control...
That have worked for me a few times that I've used...
Well well, the crystal report control, ocx etc. should have a refresh property .
In your code specify the following!
WindowShowRefreshBtn = True
If you do this then you can refresh the report data by clicking on the refresh button just like the refresh button in Crystal. The latest data will then be shown!
Hope this helps.
How can this be achieved? Could you please present more details.Quote:
Originally posted by D12Bit
How about in the form where you have your Viewer add a timer and then refresh the report using the method of the CRViewer control...
That have worked for me a few times that I've used...
It would be a great help.
Thanks
if you are using the ocx then this is the code to use ......
CrystalReport1.WindowShowRefreshBtn = True
if you are using the viewer then use this......
CRViewer1.EnableRefreshButton = True
i had to resort to using a Timer. This is annoying, sluggish and inefficient.Quote:
Originally posted by NewbieVB2003
How can this be achieved? Could you please present more details.
It would be a great help.
Thanks
---------------
Private Sub CRViewer1_DownloadFinished(ByVal loadingType As CRVIEWERLibCtl.CRLoadingType)
Timer1.Enabled = True
End Sub
---------------
... Where Timer1 with a interval value say... 100 and will call CRViewer1.refresh
I have been working on this for the past few days and puzzled by it and was coded by someone else before me. Efforts have been focused on streamlining and fix efficiency problems without causing accidental cascading collapse of the original program.
I've tried the Report.DiscardSavedData but gave me an error. CrViewer1.Refresh in turn would tell be report has not finished loading... so back to the timer again. Of course i have unchecked the "Saved Data with Report" under file in CR in .RPT prior to importing into VB's .DSR.
I am bummered....
Here my specs.
VB6 + Crystal Report 7 with .DSR files within my project.
Here's my code. If anyone has an answer, please advice. Thanks beforehand.
-----------------
Option Explicit
Dim Report As New rpt_Sale
Private Sub CRViewer1_DownloadFinished(ByVal loadingType As CRVIEWERLibCtl.CRLoadingType)
frm_Wait.Visible = False
End Sub
Private Sub Form_Load()
DoEvents
Me.WindowState = vbMaximized
frm_Wait.Visible = True
frm_Wait.lbl_Wait_Status.Caption = "Loading Data and Generating Report..."
DoEvents
Report.SelectPrinter Printer.DriverName, str_ReportPrinter, Printer.Port
Report.PaperOrientation = crLandscape
Report.PaperSize = crPaperA4
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
End Sub
Private Sub Form_Resize()
CRViewer1.Top = 0
CRViewer1.Left = 0
CRViewer1.Height = ScaleHeight
CRViewer1.Width = ScaleWidth
Me.WindowState = vbMaximized
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call EnableMaintForm(True)
End Sub
-------------------
I have found the solition for this a long tima ago...
first you have to set in your report NOT to save report data
after that you can use the
Report.DiscardSavedData ...
if you set both...then you are AOk! ...
I have finally found out why in all of heaven that i couldn't refresh the report viewer on earlier project...
after researching though various forums and CR websites, here's some common issues and methods. hope they will help:
1. CRViewer1.Refresh
2. Report.DiscardSavedData
3. Uncheck "Saved Data with Reports" in the report via >File>Option
Well.. they all didn't work for me.... because i did not Set Report to NOTHING upon exit! for a second i felt a chill as if i am closer to the primates than homosapiens. Thanks all hints people.
Here's my code:
-----------------------------
Option Explicit
Dim Report As New rpt_Sale_Top10
Private Sub CRViewer91_DownloadFinished(ByVal loadingType As CRVIEWER9LibCtl.CRLoadingType)
frm_Wait.Visible = False
End Sub
Private Sub Form_Load()
DoEvents
Me.WindowState = vbMaximized
frm_Wait.Visible = True
frm_Wait.lbl_Wait_Status.Caption = "Loading Data and Generating Report..."
Set Report = Nothing
Set Report = New rpt_Sale_Top10
DoEvents
Report.SelectPrinter Printer.DriverName, str_ReportPrinter, Printer.Port
Report.PaperOrientation = crPortrait
Report.PaperSize = crPaperA4
CRViewer91.ReportSource = Report
CRViewer91.ViewReport
End Sub
------------------------