|
-
Jul 3rd, 2006, 10:29 PM
#1
Thread Starter
New Member
[RESOLVED] Why my SetDataSource do not work?
This may sound stupid, but I am really baffled . I am new with Crystal Report and am trying to learn to pass a recordset to Crystal Report 8.5. What I did is to use the Report Expert from Crystal Report to simply generate a simple report from Publishers table in Biblio.mdb with PuID, Name, and [Company Name], which looks fine. Then, I modify the original CRViewer form to include this code (in blue below):
Dim Report As New CrystalReport1
Dim WithEvents poRS As Recordset
Dim db As Connection
Private Sub Form_Load()
Dim sConnect As String
Dim sSQL As String
Set db = New Connection
sConnect = "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=" & _
"C:\Program Files\Microsoft Visual Studio\VB98\Biblio.mdb"
db.CursorLocation = adUseClient
db.Open sConnect
Set poRS = New Recordset
sSQL = "Select PubID, Name, [Company Name] from Publishers “ & _
“Where PubID > 10"
poRS.Open sSQL, db, adOpenStatic, adLockOptimistic
Report.DiscardSavedData
Report.Database.SetDataSource poRS
Screen.MousePointer = vbHourglass
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
Screen.MousePointer = vbDefault
End Sub
simply to try to test the passing of the recordset. The report run fine, BUT with original data, NOT the passed recordset. It simply ignored my modification, without giving any error sign at all, why?
Thanks!
-
Aug 2nd, 2006, 11:29 PM
#2
Thread Starter
New Member
Re: Why my SetDataSource do not work?
I found my error already, is there anyway to take this off the forum?
-
Aug 3rd, 2006, 09:41 AM
#3
Re: Why my SetDataSource do not work?
Nope, we dont remove threads (unless they break forum rules etc).
What we do here is to mark the thread as Resolved.
(this saves time reading for those of us who like to answer questions, and also helps those who search to find answers)
You can do this by clicking on "Thread tools" just above the first post in this thread, then "Mark thread resolved".
If you give an explanation of your solution, it may well help people who have similar problems in future.
-
Aug 11th, 2006, 10:43 PM
#4
New Member
Re: Why my SetDataSource do not work?
i have the same problem with IndraG, any one can help me..i am newbie in crystal report
-
Aug 15th, 2006, 10:25 AM
#5
Thread Starter
New Member
Re: Why my SetDataSource do not work?
OK, for strange reason, if we use a non ttx file for datasource when designing the Crystal Report, it simply just refuses to discard the original data and reset the datasource. So, to solve this problem, use ttx file and active data driver, and it should do the trick. Good luck, Irene
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
|