-
June 16th, 2004, 01:47 PM
#1
Error
Hello,
Following is the code written to call a crystal report having records for branch 3 only:
Dim appl As New CRAXDRT.Application
Dim rpt As New CRAXDRT.Report
Dim dat As CRAXDRT.Database
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Set rpt = appl.OpenReport(app.path & "\password.rpt", 1)
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.Open "dsn=invdet"
rs.Open "select * from table1 where branch=3", cn, adOpenStatic, adLockPessimistic
Set dat = rpt.Database
dat.SetDataSource rs, 3, 1
CR.ReportSource = rpt
CR.ViewReport
Error:
The Report shows all the records from "table1". It resembles the same report when I run from Crystal Reports.
i.e. it is not reporting for the above recordset set.
-
June 16th, 2004, 02:13 PM
#2
My changes are in Bold.
Code:
'Get rid of these
'Dim appl As New CRAXDRT.Application
'Dim rpt As New CRAXDRT.Report
'Dim dat As CRAXDRT.Database
Dim Report as CrystalReport1 'This is the dsr file that you create
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Set rpt = appl.OpenReport(app.path & "\password.rpt", 1)
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.Open "dsn=invdet"
rs.Open "select * from table1 where branch=3", cn, adOpenStatic, adLockPessimistic
Report.SetDataSource rs, 3, 1
'Make sure CR is the name of the CrystalViewer on your form
CR.ReportSource = Report
CR.ViewReport
I'd rather be wakeboarding...
-
June 17th, 2004, 06:08 AM
#3
I do not know how to create the dsr file
-
June 17th, 2004, 11:08 AM
#4
What version of Crystal Reports are you using?
I'd rather be wakeboarding...
-
June 18th, 2004, 09:46 AM
#5
-
June 18th, 2004, 10:37 AM
#6
I'm using version 8.5 Developer Edition. When I installed it, it placed all the necessary dlls on my comuter for me.
To create a dsr file, All I have to do is click 'Project', 'Add Crystal Reports 8.5'. Then follow the directions to create a dsr file.
I'd rather be wakeboarding...
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
|