|
-
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.
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
|