Hi,
I have started leanring Crystal reports just few days before and wondering how I can access crystal report from my VB program.
Anyone pls help me. Thanks
Pammi
Have you purchased Crystal Reports separately, or are you using version 4.6 that is supplied with VB6 Ent. Ed.? The version supplied with VB (although well hidden on the 3rd CD and not installed by default), does integrate itself with the IDE so that the Report Designer option appears on the Add-Ins menu.
As regards running a report from VB, in the VB6 IDE, if you right-click on the toolbox, click on Components, scroll down until you see the Crystal Report Control, click to put a tick in the box beside it and click OK. You should get the control added to your toolbox. You can then click on the control and draw it on your form. Once that's done you can set the properties of the control to tell it which report to run etc. The control is invisible at run time.
If you have the current version of CR (8.5) you have to have the developers edition to integrate with VB. You would also have received the developers help which gives the basics.
The CD website describes many of the basics and has sample apps. There are 4 different sets of syntax, so you have to decide which you are going to use before you can learn the coding. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
Hi Wexsoft,
I am using Crystal Reports 7.0 and I know that I have to use Crystal Report Control but How that I don't know? Can u help me further that what preperties I need to set to view the report.
Pammi
Assuming you have the Crystal Report Control available (as per instructions in last reply), create a new standard EXE project, put a report control and a command button on the form. Let's assume the report is called CR1.RPT and that it's in the same directory as the project you created (if it's in a different directory, include the full path file name in the ReportFileName property).
The click event for the command button should be set as follows:
Private Sub Command1_Click()
With Form1.CrystalReport1
.ReportFileName = "CR1.rpt"
.ReportTitle = "Crystal 1"
.PrinterCopies = 1
.PrinterCollation = crptDefault
.WindowControls = True
.WindowBorderStyle = crptSizable
.WindowControlBox = True
.WindowState = crptNormal
.WindowTitle = "Previewing Crystal 1"
.Destination = crptToWindow
.PrintReport
End With
End Sub
The only property you really need is ReportFileName and the PrintReport method should preview the report.
The above works fine.
I need to pass the parameter values from VB to crystal report. Lets say i want to generate the report for a particular date. then How can I pass the parameter? Please Help.....
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.