|
-
Jul 15th, 2004, 02:57 AM
#1
Thread Starter
Member
Where am I going Wrong ?
Hi :
I have CR8.5 and the backend is SQL Server 2000. I am using Crystal viewer control in VB 6 and the report uses a DSN connection. I want to pass a recordset created during runtime to the setdatasource method but when I do this, it shows me all records instead of showing only the records of the recordset.
This following is the code, here the recordset returns only 1 record but when the crystal viewer is opened it displays all records. I have also confirmed that SAVE DATA WITH REPORT option is not checked.
Dim app As New CRAXDRT.Application
Dim rep As CRAXDRT.Report
Dim con As New Connection
Dim rs As New Recordset
Private Sub Form_Load()
con.ConnectionString = "dsn=vehicle;uid=user1;pwd="
con.Open
rs.Open "select * from attributes where attribid=1", con, adOpenKeyset, adLockPessimistic
MsgBox rs.RecordCount
Set rep = app.OpenReport("c:\report2.rpt")
rep.DiscardSavedData
rep.Database.SetDataSource rs, 3
CRViewer1.ReportSource = rep
Me.WindowState = vbMaximized
CRViewer1.ViewReport
End Sub
Private Sub Form_Resize()
With CRViewer1
.Width = Me.ScaleWidth
.Height = Me.ScaleHeight
End With
End Sub
Is there anything that I am missing ? or do I have to change something in CR ??
Somebody pls help me..
Thanks
- Marjo.
-
Jul 15th, 2004, 01:34 PM
#2
Hyperactive Member
Try ....
VB Code:
rep.Database.SetDataSource rs, 3, 1
'rep.Database.SetDataSource rs, 3
-
Jul 16th, 2004, 10:53 PM
#3
Thread Starter
Member
Thanks ARPRINCE for your reply.
I tried rep.Database.SetDataSource rs, 3, 1 but the CR still pulls all records from the table and displays, instead of showing me the records of my recordset rs.
- Marjo.
-
Jul 19th, 2004, 08:15 AM
#4
Hyperactive Member
-
Jul 19th, 2004, 11:37 PM
#5
Thread Starter
Member
It Worked. I tried the same way as it was described in the pdf.
Thanks a lot ARPRINCE.
- Marjo.
-
Feb 14th, 2005, 05:05 PM
#6
Lively Member
Re: Where am I going Wrong ?
i have never passed a recordset to a report before, every report i've ever made worked off of an odbc connection. i've been reading and i found that i have to convert my report to a report that uses a p2pmon.dll and i need to create a ttx file. can you please provide me with a sample project or a link on were i can get more detailed info.
Thank You,
Thomas
-
Feb 14th, 2005, 05:15 PM
#7
Hyperactive Member
Re: Where am I going Wrong ?
 Originally Posted by thomas eicondev
i have never passed a recordset to a report before, every report i've ever made worked off of an odbc connection. i've been reading and i found that i have to convert my report to a report that uses a p2pmon.dll and i need to create a ttx file. can you please provide me with a sample project or a link on were i can get more detailed info.
Thank You,
Thomas
I believe if you are using version 9 and up, you don't need a TTX file. I actually wouldn't recommend passing an ADO recordset to a report. It was just a pain especially when you have sub reports. I mean, I have never been able to make it work with sub reports. Then again, I never really investigated it throughly.
Now, I mostly use ODBC and SQL sprocs for my report. Maintenance is a breeze. If you are using a SQL server as your back end, I could give you some codes as a walk through.
-
Feb 14th, 2005, 06:44 PM
#8
Lively Member
Re: Where am I going Wrong ?
i was able to get the report up and running, what type of issues did you have with subreports? i will need to have subreports.
could you please send me the code that you mentioned.
thank you,
thomas
-
Feb 14th, 2005, 07:02 PM
#9
Lively Member
Re: Where am I going Wrong ?
1- are you using stored procs in your report,i can't even see my stored procs in crystal when i'm creating a report.
2- do you populate the paramaters in your stored procs using parameters in your report?
3- how do you treat blank parameters. if my proc has 3 parameters (cust, division, salesman) and i only want to view the report filtered with 2 of the 3 parameters (division and salesman) how does the report react?
thank you,
thomas
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
|