i want to create a report in crsytal report, which should show data present in grid of a vb form, (not from the data base as we do usually).... how to do this???
Printable View
i want to create a report in crsytal report, which should show data present in grid of a vb form, (not from the data base as we do usually).... how to do this???
How does the data get into the grid?
I will explain it further..
data is in database, we get it into a recordset and then put into the grid...the only important thing is that we apply a complicated formula to modifiy the data in recordset before populating the grid..and the formula can change depending of several factors....
our exact requirement is to just print the contents of the grid as a report.
According to their website you can use the .SetPrivateData method to pass a ADO recordset to the crystal report. This is the code they give (the crucial bit is in red):
VB Code:
'General Declarations Dim crpApplication As CRPEAuto.Application Dim crpReport As CRPEAuto.Report Dim crpDatabase As CRPEAuto.Database Dim crpTables As CRPEAuto.DatabaseTables Dim crpTable As CRPEAuto.DatabaseTable Dim adoRs As ADODB.Recordset Private Sub Form_Load() Set crpApplication = CreateObject("crystal.crpe.application") End Sub Private Sub Command1_Click() 'Now that the report has been created, we can set the report 'object to it (open the report) Set crpReport = crpApplication.OpenReport(App.Path & "\test.rpt") 'We need to set the database, database tables and database table 'to get to the method that we need: SetPrivateData Set crpDatabase = crpReport.Database Set crpTables = crpDatabase.Tables Set crpTable = crpTables.Item(1) 'SetPrivateData sets the report data to the recordset in memory 'assuming the adoRS has been populated somewhere in the application [COLOR=Red]Call crpTable.SetPrivateData(3, adoRs) [/COLOR] crpReport.Preview End Sub
thanks a lot !
do we need some references, dll , etc to use crpe...further can u put some ore light on crpe.