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!

Need to launch Crystal Reports 10.0 report using VB 6.0 SP5

Status
Not open for further replies.

css1015

Programmer
Oct 29, 2003
20
0
0
US
Hi,

I am totally new to Crystal Reports 10.0 from the programming point of view. Crystal Reports 8.5 used to provide a Crystal Report OCX control that I could place on my VB 6.0 form and launch the 8.5 report from within VB 6.0.

But with Crystal Reports 10.0, that control is not available. I am not sure which component or control I need to use to assign properties to in my VB 6.0 code. I am sure someone has accomplished this before, if they can provide details of the control/component and what the code for assigning properties to it are, I would greatly appreciate it.

Thanks a bunch in advance.

Chad
 
Have a look at this FAQ: faq768-5374. It includes the references/components you need in VB 6, and more code than you probably need, but it should get you started.

You can also download the RDC (Report Designer Compnent) samples for VB 6/CR 10 here:

-dave
 
css1015,
Maybe you can help me. Since you have experience with Crystal Report 8.0 & VB, what do i have to reference within visual basic to create reports.

The Crystal report version that i have, comes with a compiler. The report is going to compiled but main objective is to pass an value from VB6 into the already created report. (it is possible or should i create the report from VB6?).

thanks, any help is better then no help

Sh0jin

Sh0jin
 
Sh0jin,

Add a component/reference to the Crystal Report Control in your VB project.

Let us say your Crystal Report Control is named ReportControl, use this code to connect and view a report:

With ReportControl

'Set path & report name
.ReportFileName = strDataPath & strReportSource

'Define Connection String to the MSSQL server
.Connect = "DSN=DataSourceName;UID=sa;PWD=sa;DSQ=SampleDB"

'Set report to use most current data
.DiscardSavedData = True

'Set Crystal's selection formula based on user input
.SelectionFormula = "<fieldname> = " & Chr(34) & strFieldValue & Chr(34)

'Set report destination to print to window
.Destination = crptToWindow

'Print report
.PrintReport

'Allow users to see detail records by drill down feature
.WindowAllowDrillDown = True

'End with statement
End With

The field name would be one of the field names used in the report that you use as a criteria. Hope this helps.

Chad
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top