|
-
Jan 25th, 2007, 06:03 AM
#1
Thread Starter
New Member
VB6.0 and CR 8.0 problem
I am using VB6.0 , Access 2000,abd CR 8.0.
I am using the following code.
'Add reference to Crystal Reports x.x ActiveX Designer RunTime Library
'Add component Crystal Reports Viewer Control
'Add reference to Microsoft ActiveX Data Objects 2.8 Library
'oCnn = current open ADO connection object
Private Sub Command1_Click()
Dim oApp As CRAXDRT.Application
Dim oReport As CRAXDRT.Report
Dim oRs As ADODB.Recordset
Dim sSQL As String
sSQL = "SELECT * FROM Table1"
Set oRs = New ADODB.Recordset
Set oRs = oCnn.Execute(sSQL)
Set oApp = New CRAXDRT.Application
Set oReport = oApp.OpenReport(App.Path & "\MyReport.rpt", 1)
(1) oReport.Database.SetDataSource oRs, 3, 1
crvMyCRViewer.ReportSource = oReport
crvMyCRViewer.ViewReport
End Sub
I had two queries:-
(a) I am getting an error report on line marked (1) that " Subscript beyond Range". I am not able to find a solution. when "MyReport.rpt" is already connected to a database and is configured, I am getting a report, but when a new blank report is used in its palce, I am not getting any result. Can anyone please tell me how to proceed ?
(2) If the report is automatically placed in the form by the VB, can I get a report? If so, can anyone give me a sample code?
thanks in advance,
GeoNav
-
Jan 25th, 2007, 12:33 PM
#2
Re: VB6.0 and CR 8.0 problem
but when a new blank report is used in its palce, I am not getting any result
Crystal does not magically generate a report based on a recordset. You still need to add the fields to the report file.
Since you are using recordsets as your datasource you don't need to login to a database. From the Add Database screen, choose the More Data Sources -> Active Data -> Active Data (Field Definitions Only) and setup the information.
See the topic Data Definition Files in the developer help file for more information.
-
Jan 26th, 2007, 06:31 AM
#3
Thread Starter
New Member
Re: VB6.0 and CR 8.0 problem
Hello brucevde,
Thanks for the reply.
Can you help me in the first part of the question?
Thanks
GeoNav
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
|