Results 1 to 5 of 5

Thread: Crystal Reports Preview in VB

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    736

    Question Crystal Reports Preview in VB

    Hi,

    I am using the following code to set the Data Source for a crystal report to a disconnected recordSet created in VB. This works perfectly when printing the report, but is there a way to get a preview window of the report? Thanks for any ideas.
    VB Code:
    1. Private Sub cmdReport_Click()
    2.     Dim CRXApplication As New CRAXDRT.Application
    3.     Dim CRXReport As CRAXDRT.Report
    4.     Set CRXReport = CRXApplication.OpenReport(App.Path & "\retention.rpt", 1)
    5.     Dim CRXDatabase As CRAXDRT.Database
    6.     Set CRXDatabase = CRXReport.Database
    7.     CRXDatabase.SetDataSource RS, 3, 1
    8.     CRXReport.PrintOut
    9. End Sub

  2. #2
    Addicted Member Sibby's Avatar
    Join Date
    Feb 2001
    Location
    Milwaukee, WI *The United States of America*
    Posts
    144
    Do you have the "Crystal Report Smart Viewer" added to your project? Once you add that component to it's own form, you can show the user a preview....

    Look in your list of Components AND REFERENCES. Add and and experiment with it a bit....should be pretty easy if you're familiar with CR.

    Hopefully that answered you question....
    If you can think it....you can code it....

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    736
    Thanks Sibby. I guess the biggest problem is that I am just learning Crystal Reports on my own. If I create an access table in VB and point the Crystal report to the database, I can use the CRViewer control to get a preview.

    But, I was trying to find a way that I could create a disconnected ADO recordset in VB instead of needing to build the access table.

    Should I be able to pass a recordSet that is built on the fly to the CRViewer?

    Thanks.

  4. #4
    Addicted Member Sibby's Avatar
    Join Date
    Feb 2001
    Location
    Milwaukee, WI *The United States of America*
    Posts
    144
    <inhale through teeth> oooooo, don't know if that's possible. I have used CR in a few projects, but by no means am an expert. Have you searched the forums thoroughly on this? I would think you COULD do what you're describing...but at the same time CR are really touchy, and pretty lame at sometimes on it's limitations. Hopefully a CR guru will step forward and take the reins on this one......sorry jbart....
    If you can think it....you can code it....

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Inserting on line should do it for you. Try:

    CrystalReport1.Destination = crptToWindow


    Change CrystalReport1 to the name you have for your Crystal Report control.

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