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

Crystal report

Hi when i call the report it appears blank and a error window with no msg in it and second error window with sql server error. My crystal report is connected to a STORED PROC. The report independently runs

Private Sub Form_Load()

Dim CrApp As CRAXDRT.Application
Dim CrRep As CRAXDRT.Report
Dim oCrystalParameters As CRAXDRT.ParameterFieldDefinitions
Dim CrtParameters As CRAXDRT.ParameterFieldDefinitions
Dim CrtParameter As CRAXDRT.ParameterFieldDefinition

Dim dd As String
dd = "YIOP2795776"

Set CrApp = New CRAXDRT.Application
Set CrRep = CrApp.OpenReport("C:\J.rpt")
 CrRep.Database.Tables.Item(1).SetLogOnInfo "server", "db", "uname", "pwd"
 CrRep.EnableParameterPrompting = False


CrRep.DiscardSavedData

Set CrtParameters = CrRep.ParameterFields
For Each CrtParameter In CrtParameters
  If CrtParameter.Name = "{?@strOrderNo}" Then
       CrtParameter.AddCurrentValue dd
  End If
Next CrtParameter


CRViewer1.ReportSource = CrRep
CRViewer1.ViewReport
Set CrRep = Nothing
Set CrApp = Nothing
End Sub
0
AnnaJames77
Asked:
AnnaJames77
  • 2
3 Solutions
 
Éric MoreauSenior .Net ConsultantCommented:
instead of having CR feeding itself from the SP, load a dataset and push it to your report: http://emoreau.com/Entries/Articles/2006/09/Feeding-Crystal-Reports-from-your-application.aspx
0
 
mastooCommented:
Don't you need error handling, and what is the sql error message?
0
 
mlmccCommented:
Try putting the DiscardSavedData line right after the OpenReport

mlmcc
0
 
mlmccCommented:
Another thing to try

Comment this line out
CrRep.EnableParameterPrompting = False

Does the report prompt for a value and then run correctly?

mlmcc
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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