Link to home
Start Free TrialLog in
Avatar of AnnaJames77
AnnaJames77

asked on

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
SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Don't you need error handling, and what is the sql error message?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial