Results 1 to 5 of 5

Thread: [RESOLVED] Why my SetDataSource do not work?

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2006
    Posts
    10

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

  2. #2

    Thread Starter
    New Member
    Join Date
    Feb 2006
    Posts
    10

    Re: Why my SetDataSource do not work?

    I found my error already, is there anyway to take this off the forum?

  3. #3
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    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.

  4. #4
    New Member
    Join Date
    Aug 2006
    Posts
    1

    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

  5. #5

    Thread Starter
    New Member
    Join Date
    Feb 2006
    Posts
    10

    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
  •  



Click Here to Expand Forum to Full Width