Results 1 to 2 of 2

Thread: [RESOLVED] Data not refresh in vb6 - Cr8.5

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Location
    Kolkata, India
    Posts
    290

    Resolved [RESOLVED] Data not refresh in vb6 - Cr8.5

    Hi everybody

    I need your help for calling crystal report 8.5 into VB6. Below mention VB code i use for display the report but if 'CRReport.DiscardSavedData' is activate then it show error message "Server has not yet been opened"
    else display the report but not refresh the data.

    (I am useing SQL Server 2000 connection through DSN
    ConnectAcct.Open "DSN=Asmacct; User Id=sa; password=;")

    Pls help me how to call report with refreshing data everytime..
    VB Code:
    1. Private Sub CrAppView()
    2.     Dim CRApp As CRAXDRT.Application
    3.     Dim CRReport As CRAXDRT.Report
    4.     Dim CRRepRs As ADODB.Recordset
    5.     Dim CRSql As String
    6.    
    7.     Set CRApp = New CRAXDRT.Application
    8.     Set CRRepRs = New ADODB.Recordset
    9.    
    10.     CRViewer.DisplayBorder = False
    11.     CRViewer.EnableGroupTree = False
    12.     CRViewer.DisplayTabs = False
    13.     CRViewer.EnableDrillDown = False
    14.     CRViewer.EnableRefreshButton = False
    15.     CRViewer.EnableExportButton = True
    16.    
    17.     CRSql = "select * from PluckDetail where monyear = '" & TxtMonyear.Text & "' order by dvcode, empcode"
    18.    
    19.     CRRepRs.Open CRSql, ConnectAcct, adOpenStatic, adLockReadOnly
    20.    
    21.     Set CRReport = CRApp.OpenReport(App.Path & "\pluck31.rpt")
    22.    
    23.     CRReport.FormulaFields.GetItemByName("compname").Text = "'" & CompanyName & "'"
    24.     CRReport.FormulaFields.GetItemByName("monthname").Text = "'" & TxtMonyear.Text & "'"
    25.    
    26.     CRReport.DiscardSavedData
    27.     CRReport.Database.SetDataSource CRRepRs
    28.     CRViewer.ReportSource = CRReport
    29.     CRViewer.ViewReport
    30.    
    31.     Call PreviewZoom        'Zoom the Report View
    32.    
    33.     CRRepRs.Close
    34.     Set CRApp = Nothing
    35.     Set CRReport = Nothing
    36.     Set CRRepRs = Nothing
    37. End Sub
    Waiting for help...

    Thanks



    ASM
    Last edited by Hack; May 17th, 2006 at 06:20 AM. Reason: Fixed [vbcode] [/vbcode] tags

  2. #2
    Lively Member
    Join Date
    Mar 2006
    Posts
    94

    Re: Data not refresh in vb6 - Cr8.5

    Energy can be neither created not destroyed. It can only be wasted.

    Red Green

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