• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 476
  • Last Modified:

Crystal Viewer is not viewing report

This is my code:

Dim crxApp As New CRAXDRT.Application
    Dim crxRpt As CRAXDRT.Report

    ' Open the report
    Set crxRpt = crxApp.OpenReport(App.Path & "\PrtPicTkt.rpt")

    ' Clear any saved data to force the report to read from the db
    crxRpt.DiscardSavedData

    ' Set the connection for the report.
    crxRpt.Database.Tables(1).SetLogOnInfo "Macola02", "Macola02", "administrator", "odyssey"

    ' Set up the report source
    frmUserInput.CRViewer1.ReportSource = crxRpt
    'frmUserInput.CrystalReport1.ReportFileName = App.Path & "\PrtPicTkt.rpt"
   
    Do ' more than one report per run

        ' Create itemSelect
 
        ' Set up selection formula
       ' frmUserInput.CrystalReport1.SelectionFormula = itemSelect
        crxRpt.RecordSelectionFormula = itemSelect

        ' View report
        frmUserInput.CRViewer1.ViewReport
        ' frmUserInput.CrystalReport1.Action = 1
 
    Loop    

When I execute this code it does not bring up the viewer.  If I uncomment the three CrystalReport1 statements , then I get the viewer but it is not persistent.  It lasts a second and then the next report is viewed without waiting for a response from the first view.

Can anyone tell me what's going wrong?
0
tblock
Asked:
tblock
1 Solution
 
mlmccCommented:
YOur code looks good.  What does itemSelect have?

You have your viewing in a loop thus it keeps trying to recreate the viewer.

Basic code I use is



Option Explicit
Private crApp As CRAXDRT.Application
Private crRpt As CRAXDRT.Report

'
'   Open report
'
    Set crApp = New CRAXDRT.Application

    Set crRpt = crApp.OpenReport(txtReportName, 1)

'
'   Set flags for CRViewer
'

    crRpt.MorePrintEngineErrorMessages = False
    crRpt.EnableParameterPrompting = False
    crRpt.DisplayProgressDialog = False
    crRpt.DiscardSavedData

'
' Set the viewer's report source to the Report object
'
  Me.rptCRViewer.ReportSource = crRpt
  Me.rptCRViewer.ViewReport
  Me.Show

mlmcc
0
 
vidruCommented:
Have a look at this whitepaper on displaying multiple reports in the same Viewer using the ReportSourceRoute: http://support.businessobjects.com/library/kbase/articles/c2004679.asp

-dave
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now