Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal Report as Parameter

Status
Not open for further replies.

mattyboy2000

Programmer
Jul 31, 2002
129
0
0
GB
Hello. I'm trying to send a crystal report as a parameter into a function to populate a CrystalReport Viewer.

I cant seem to find the type of object to declare the parameter. I'm currently using the 'Object' object but its limiting my functionallity:

public sub DoSomething(objCR as Object)
'Stuff
end sub

Please help

Matt [thumbsdown]
 
I think this is the class type for the crystal report

CrystalDecisions.CrystalReports.ViewerObjectModel.ReportObject
 
I have many reports that I run from the same form, so I wrote a small sub to handle the logon duties for the report. You can use the following.
Code:
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared

Public Class Form1
...
...
...
Dim crReportDocument as New ReportDocument()

crReportDocument.Load("C:\report.rpt", OpenReportMethod.OpenReportByTempCopy)

Call LogonReport(crReportDocument)


End Class


Public Sub LogonReport(ByVal crReportDocument as CrystalDecisions.CrystalReports.Engine.ReportDocument)


...
...
...

End Sub


Hope this helps. If you need more help with anything, feel free to ask. This is all I do for my company, develop in .NET and Crystal Reports. I have become quite proficient and I would love to help anyone who needs it. This stuff can be very difficult. I have got it down pretty good using VB6 and the RDC, .NET, and ASP.
 
Thanks but when I tried the code the following object could not be found:

CrystalDecisions.CrystalReports.Engine.ReportDocument

I have imported 'CrystalDecisions.CrystalReports.Engine'. Any ideas??

Thanks for your help

Matt [tongue]
 
Did you try adding the Crystaldecisions.crystalreports.engine as a project reference? Worked for me.
 
Thanks!!!!!!!! It works! But I have another problem!

When I try and pass a parameter into the crystal report it seems to ignore it and prompts me for the value. It worked when the report viewer was on the same form, but now it's in another form it wont work!!!

Any advice will be greatfully recieved!

below is the function that populates the Crystal Report Viewer. An interesting thing is that the zoom isn't working correctly either.??!!??

Public Sub setDataSource(ByRef objCR As CrystalDecisions.CrystalReports.Engine.ReportDocument, ByRef objParameters As ParameterFields)
Me.CrystalReportViewer1.ReportSource = Nothing

Me.CrystalReportViewer1.ParameterFieldInfo = objParameters
Me.CrystalReportViewer1.ReportSource = objCR

Me.CrystalReportViewer1.ParameterFieldInfo.Clear()
Me.CrystalReportViewer1.Zoom(50)
End Sub


if you can help it would be great.

Thanks

Matt [morning]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top