Crystal Reports

Posted on 2005-04-13
Last Modified: 2010-04-17
I need to open up a file and read the content in crystal reports. Is it possible? Can I perform COM objects from Crystal Reports? Or shell a vbscript everytime the report is ran?
Question by:HackLife
    LVL 5

    Expert Comment

    Create frmNAME (where NAME is a name you want to give to the Form), open it in Project mode then double click the Crystal Reports control from the Visual Basic Toolbar. The Control is now added to the Form and it will be invisible during runtime. The default name of the Control is CrystalReport1, you can leave it like that. In the Click event of the Report button you ad to the Form, write the following code:
    Private Sub cmdReport_Click()
    Dim V_INCH, H_INCH As Long
    H_INCH=1440/Screen.TwipsPerPixelX ' these conversions help you to set the window where the file will be printed, using inch
    V_INCH=1440/Screen.TwipsPerPixelY ' instead of twips
    CrystalReport1.Destination=0 ' value 0 indicates that the file will be printed on the screen
    CrystalReport1.ReportFilename="C:\Directory\Filename" ' write the Directory where the file is placed and the name of the File
    CrystalReport1.WindowTitle="Any title you choose"
    CrystalReport1.WindowTop=1*V_INCH     ' window will be placed at 1 inch from top of screen, you can choose another value
    CrystalReport1.WindowLeft=1*V_INCH     ' window will be placed at 1 inch from left of screen, you can choose another value
    CrystalReport1.WindowHeight=3*V_INCH     ' window will be 3 inch high, you can choose another value
    CrystalReport1.WindowWidth=6*V_INCH     ' window will be 6 inch width, you can choose another value
    CrystalReport1.Action=1 ' value 1 indicates that printing must start
    End Sub

    When you run the program and click on the "Report" button, the specified File will be printed on the screen in the window as defined.

    Good luck,
    LVL 4

    Author Comment

    I don't have a visual basic tool bar.  I use crystal reports v.10. Anything else?
    LVL 5

    Accepted Solution

    If you read the users manual that came with crystal Report v.10, you should know that Crystal Reports v.10 includes powerful .NET, Java and COM report processing components that can be easily embedded into your applications. You have a range of viewers to choose from and without additional coding you can let end users drill down into reports, sort/filter information, refresh and print reports, and export them into many formats including PDF, Excel, and Word.
    I could only guess what you need from your short question, therefore my previous answer was just a waste of time. There are still some issues, like: what kind of file would you like to open? But maybe this is not important and someone smarter than me can help you out!

    LVL 4

    Author Comment

    Sorry, my company gave me the CD and license but no manual. How do I install these components or embed them as you say? This will make my life easier because I can then run code from the back.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
    Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now