Link to home
Start Free TrialLog in
Avatar of spritep
spritep

asked on

How to call Crystal Reports

i just want to know how to call a crystal reports. For example i want to call it from a visual basic program with SQL statement.

What i want to do is to pass the data i have selected from my visual basic program to Crystal reports and direct it to printer.

pls help me on this.

thanks in advance,

spritep
Avatar of vspeter
vspeter

I don't think that you can pass your data directly to crystal report. However have your query as stored procedure and in designing your report, select the stored procedure as your input.

ASKER CERTIFIED SOLUTION
Avatar of entretec
entretec

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
First you must add the control to your vb program, so had the crystal Report.ocx control and place it on the from. then supose you give it the name REPORT.
then place a command button in the form and in it place the code:

Report.ReportFileName = "c:\report_file_name.rpt" 'you report file name and path
Report.WindowTitle = "My Report"

'here you must place the formula. between quotes you must put the database table name (socios) and then a point (.) and the field to search (n_socio)
Report.SelectionFormula = "{socios.n_socio} =" & value_to_find
Report.Action = 1