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