Results 1 to 9 of 9

Thread: Where am I going Wrong ?

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2002
    Posts
    59

    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.

  2. #2
    Hyperactive Member ARPRINCE's Avatar
    Join Date
    Mar 2003
    Location
    Pinoy in NJ
    Posts
    381
    Try ....
    VB Code:
    1. rep.Database.SetDataSource rs, 3,  1
    2. 'rep.Database.SetDataSource rs, 3

  3. #3

    Thread Starter
    Member
    Join Date
    Nov 2002
    Posts
    59
    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.

  4. #4
    Hyperactive Member ARPRINCE's Avatar
    Join Date
    Mar 2003
    Location
    Pinoy in NJ
    Posts
    381

  5. #5

    Thread Starter
    Member
    Join Date
    Nov 2002
    Posts
    59
    It Worked. I tried the same way as it was described in the pdf.
    Thanks a lot ARPRINCE.

    - Marjo.

  6. #6
    Lively Member
    Join Date
    Sep 2003
    Posts
    74

    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

  7. #7
    Hyperactive Member ARPRINCE's Avatar
    Join Date
    Mar 2003
    Location
    Pinoy in NJ
    Posts
    381

    Re: Where am I going Wrong ?

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

  8. #8
    Lively Member
    Join Date
    Sep 2003
    Posts
    74

    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

  9. #9
    Lively Member
    Join Date
    Sep 2003
    Posts
    74

    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
  •  



Click Here to Expand Forum to Full Width