|
-
Sep 1st, 2005, 02:45 AM
#1
Thread Starter
Member
Urgent !!! data directly from datagrid to crystal report
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???
-
Sep 1st, 2005, 05:46 AM
#2
Re: Urgent !!! data directly from datagrid to crystal report
How does the data get into the grid?
-
Sep 3rd, 2005, 01:04 AM
#3
Thread Starter
Member
Re: Urgent !!! data directly from datagrid to crystal report
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.
-
Sep 4th, 2005, 03:13 PM
#4
Hyperactive Member
Re: Urgent !!! data directly from datagrid to crystal 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
-
Sep 6th, 2005, 06:21 AM
#5
Thread Starter
Member
Re: Urgent !!! data directly from datagrid to crystal report
thanks a lot !
do we need some references, dll , etc to use crpe...further can u put some ore light on crpe.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|