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", "password"
' 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?
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", "password"
' 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?