Results 1 to 10 of 10

Thread: Refreshing Data

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Posts
    1

    Refreshing Data

    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

  2. #2
    New Member
    Join Date
    Nov 2002
    Posts
    1

    help reduired

    hi friend....i am also trying to do the same thing..if u have found any solution just post it to [email protected]

  3. #3
    Hyperactive Member
    Join Date
    Oct 2000
    Location
    Sydney Australia
    Posts
    476
    If you are using a Crystal control it's
    VB Code:
    1. CrystalReport1.DiscardSavedData = True
    Other ways of displaying a report will have similar methods

    FW

  4. #4
    Hyperactive Member D12Bit's Avatar
    Join Date
    Oct 2000
    Location
    Guatemala
    Posts
    373
    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...
    "Who Dares Wins" - "Quien se Arriesga Gana"
    Mail me at:

  5. #5
    Lively Member Joffies's Avatar
    Join Date
    Aug 2002
    Location
    London
    Posts
    119

    Refresh

    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.
    Do, or do not. There is no 'try'.

  6. #6
    Lively Member
    Join Date
    May 2003
    Posts
    86
    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...
    How can this be achieved? Could you please present more details.
    It would be a great help.
    Thanks
    Last edited by NewbieVB2003; Jun 13th, 2003 at 07:40 PM.

  7. #7
    Lively Member Joffies's Avatar
    Join Date
    Aug 2002
    Location
    London
    Posts
    119

    ok..

    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
    Do, or do not. There is no 'try'.

  8. #8
    Member
    Join Date
    Nov 2003
    Location
    Devron System
    Posts
    53
    Originally posted by NewbieVB2003
    How can this be achieved? Could you please present more details.
    It would be a great help.
    Thanks
    i had to resort to using a Timer. This is annoying, sluggish and inefficient.

    ---------------
    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
    -------------------
    Last edited by W01fgang; Nov 26th, 2003 at 12:11 PM.

  9. #9
    Hyperactive Member D12Bit's Avatar
    Join Date
    Oct 2000
    Location
    Guatemala
    Posts
    373

    Blast! from the past!

    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! ...
    "Who Dares Wins" - "Quien se Arriesga Gana"
    Mail me at:

  10. #10
    Member
    Join Date
    Nov 2003
    Location
    Devron System
    Posts
    53
    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
    ------------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width