AnnaJames77
asked on
CRYSTAL REPORT
i get an error,server has not yet been opened
Private Sub Form_Load()
Dim CrApp As CRAXDRT.Application
Dim CrRep As CRAXDRT.Report
Dim oCrystalParameters As CRAXDRT.ParameterFieldDefi nitions
Dim CrtParameters As CRAXDRT.ParameterFieldDefi nitions
Dim CrtParameter As CRAXDRT.ParameterFieldDefi nition
Dim dd As String
dd = "YIOP2795776"
Set CrApp = New CRAXDRT.Application
Set CrRep = CrApp.OpenReport("C:\JSMa. rpt")
CrRep.DiscardSavedData
Set CrtParameters = CrRep.ParameterFields
For Each CrtParameter In CrtParameters
If CrtParameter.Name = "{?@strOrderNo}" Then
CrtParameter.AddCurrentVal ue dd
End If
Next CrtParameter
CRViewer1.ReportSource = CrRep
CRViewer1.ViewReport
Set CrRep = Nothing
Set CrApp = Nothing
End Sub
Private Sub Form_Load()
Dim CrApp As CRAXDRT.Application
Dim CrRep As CRAXDRT.Report
Dim oCrystalParameters As CRAXDRT.ParameterFieldDefi
Dim CrtParameters As CRAXDRT.ParameterFieldDefi
Dim CrtParameter As CRAXDRT.ParameterFieldDefi
Dim dd As String
dd = "YIOP2795776"
Set CrApp = New CRAXDRT.Application
Set CrRep = CrApp.OpenReport("C:\JSMa.
CrRep.DiscardSavedData
Set CrtParameters = CrRep.ParameterFields
For Each CrtParameter In CrtParameters
If CrtParameter.Name = "{?@strOrderNo}" Then
CrtParameter.AddCurrentVal
End If
Next CrtParameter
CRViewer1.ReportSource = CrRep
CRViewer1.ViewReport
Set CrRep = Nothing
Set CrApp = Nothing
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
its oledb
TRY TO MAKE IT SIMPLE Initially,
Remove Password from Report, and then check,
Try Executing a Very basic Report without any parameter, IT will help you narrow down the problem...
Are you able to Execute normal SQL from your code to Database ?
Remove Password from Report, and then check,
Try Executing a Very basic Report without any parameter, IT will help you narrow down the problem...
Are you able to Execute normal SQL from your code to Database ?
ASKER
yes without passing parameter it executes. Am trying to pass a parameter
ASKER
without passing parameter i dont have to use the logontoserver line. It executes with the below code
Private Sub Form_Load()
Dim CrApp As CRAXDRT.Application
Dim CrRep As CRAXDRT.Report
Dim dd As String
dd = "YIOP2795776"
Set CrApp = New CRAXDRT.Application
Set CrRep = CrApp.OpenReport("C:\JSMa. rpt")
CRViewer1.ReportSource = CrRep
CRViewer1.ViewReport
Set CrRep = Nothing
Set CrApp = Nothing
End Sub
Private Sub Form_Load()
Dim CrApp As CRAXDRT.Application
Dim CrRep As CRAXDRT.Report
Dim dd As String
dd = "YIOP2795776"
Set CrApp = New CRAXDRT.Application
Set CrRep = CrApp.OpenReport("C:\JSMa.
CRViewer1.ReportSource = CrRep
CRViewer1.ViewReport
Set CrRep = Nothing
Set CrApp = Nothing
End Sub
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanku for your reply. With the below code it excuetes. But it prompts me for the parameter. I have actually passed the parameter to the report. then why does it promt me again. if i use enableprompting=false, report appears with no value. PLS Help
Private Sub Form_Load()
Dim CRApp As New CRAXDRT.Application
Dim CRReport As New CRAXDRT.Report 'crystal report object
Dim CrtParameters As CRAXDRT.ParameterFieldDefi nitions
Dim sRPTFile As String
Dim simula As String
Dim tapos As String
sRPTFile = "C:\JSMa.rpt"
Set CRReport = CRApp.OpenReport(sRPTFile)
simula = "GTRYR"
' tapos = Format(DTPicker2.Value, "YYYY/MM/DD")
With CRReport
.DiscardSavedData
.Database.Tables.Item(1).S etLogOnInf o ".", "db", "sa", "sa"
Set CrtParameters = CRReport.ParameterFields
.ParameterFields.GetItemBy Name("@str OrderNo"). AddDefault Value simula
End With
'Show Report
CRViewer1.ReportSource = CRReport
CRViewer1.EnableExportButt on = True
CRViewer1.DisplayGroupTree = False
CRViewer1.EnableDrillDown = True
CRViewer1.EnableDrillDown = False
CRViewer1.EnableCloseButto n = True
CRViewer1.ViewReport
CRViewer1.Zoom (100)
CRViewer1.Visible = True
CRViewer1.ZOrder 0
End Sub
Private Sub Form_Load()
Dim CRApp As New CRAXDRT.Application
Dim CRReport As New CRAXDRT.Report 'crystal report object
Dim CrtParameters As CRAXDRT.ParameterFieldDefi
Dim sRPTFile As String
Dim simula As String
Dim tapos As String
sRPTFile = "C:\JSMa.rpt"
Set CRReport = CRApp.OpenReport(sRPTFile)
simula = "GTRYR"
' tapos = Format(DTPicker2.Value, "YYYY/MM/DD")
With CRReport
.DiscardSavedData
.Database.Tables.Item(1).S
Set CrtParameters = CRReport.ParameterFields
.ParameterFields.GetItemBy
End With
'Show Report
CRViewer1.ReportSource = CRReport
CRViewer1.EnableExportButt
CRViewer1.DisplayGroupTree
CRViewer1.EnableDrillDown = True
CRViewer1.EnableDrillDown = False
CRViewer1.EnableCloseButto
CRViewer1.ViewReport
CRViewer1.Zoom (100)
CRViewer1.Visible = True
CRViewer1.ZOrder 0
End Sub
Actually there are different ways to execute Report.
I used like :
Dim RptDocument As New CrystalDecisions.CrystalRe ports.Engi ne.ReportD ocument
RptDocument.SetParameterVa lue("JOBNO ", Val1)
I used like :
Dim RptDocument As New CrystalDecisions.CrystalRe
RptDocument.SetParameterVa
ASKER
i'm using vb6 and CR 8.5
Ohh Sorry ,
I assume Vb.Net...
I dont have exact code so i cant help in this regard more... But I hope you can achieve it as you are close to success,
I assume Vb.Net...
I dont have exact code so i cant help in this regard more... But I hope you can achieve it as you are close to success,
ASKER
Thankyou Musalman for all your replies
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You could also use
.ParameterFields(1).AddCur rentValue simula
mlmcc
.ParameterFields(1).AddCur
mlmcc
By OLEDB OR ODBC ?
If ODBC, Make sure you have correct ODBC connection with all user / pwd...