Leccion 10 - Usando El Data Report

Embed Size (px)

Citation preview

  • 8/2/2019 Leccion 10 - Usando El Data Report

    1/3

    VISUAL BASIC CON BASE DE DATOS IDSYSTEMS 2012

    LECCION 10 USANDO EL DATAREPORT DE VB 6

    With Visual Basic 6 there are two methods for developing reports. Reports can be created within

    the Visual Basic development environment by using Microsoft Data Reports, or by using the version of

    Crystal Reports included with Visual Basic by accessing Crystal Reports' .RPT file via the Crystal's

    ActiveX control. (Of course, you also can use another version of Crystal Reports or another third-partyreportingprogram; however, Data Reports and Crystal Reports 4.6.1 both come with Visual Basic 6.)

    Microsoft Data Reports

    With the new Microsoft Data Reports, a developer can add a report directly to a Visual Basic project.

    The report can be designed, saved, and compiled with a project just as a form or class would be. This featureintegrates well with the Visual Basic IDE, and you can create reports natively and intuitively as you would

    create any otherform.

    There are two major differences between creating reports with Microsoft Data Reports and creatingother forms within theproject:

    The Data Report dimension is based on the printed page, whereas a form is based on twips. The Data Report does not use the intrinsic controls or ActiveX controls that regular Visual Basic

    forms use; they have their own report intrinsic controls.

    With Microsoft Data Reports, a report can be displayed to the screen in the form of a Print Preview

    window. From this window the user can print the report to a printer or export the report to a file (including

    HTML). The report can be printed to a printer or exported to a file without any user intervention by using

    Visual Basic code.

    Crystal Reports

    Crystal Reports is still included with Visual Basic 6. It includes the Crystal Reports Designer,

    ActiveX control, and necessary runtimes. Visual Basic 6 is backward-compatible with projects created

    with Crystal Reports with earlier versions of Visual Basic.

    Any Crystal Reports report must be created using the report designer. Although certain report

    elements can be changed at runtime through the Crystal Reports OLE custom control, the control does not

    have the ability to create a report from scratch.

    Running and Configuring Crystal Reports Designer

    The Crystal Reports Designer works as a separate process from Visual Basic and keeps the report

    definition in a report definition file with a .rpt file extension. You should try to save your report definition

    files in your Visual Basic project directory to make project management and program distribution easier.

    If you installed Visual Basic with the defaults, you'll find a Crystal Reports icon in the Microsoft

    Visual Basic 6.0 program group. You canalso start Crystal Reports by selecting Add-Ins|Report Designer

    from the Visual Basic main menu.

    All the How-To's in this chapter assume that your Crystal Reports Designer program is set up the

    way ours is. Select File|Options from the Crystal Reports main menu. On the Layout tab, check the Show

    Field Names option. On the New Report tab (see Figure

    9.1), check the Use Report Gallery for new reports option. You can also enter a report directory

    as the default location for report definition files.

    Leccion 10 Usando el DataReport Pgina 1

  • 8/2/2019 Leccion 10 - Usando El Data Report

    2/3

    VISUAL BASIC CON BASE DE DATOS IDSYSTEMS 2012

    Figure 9.1. The Crystal Reports Designer File Options dialogbox.

    Printing Reports

    You have two printing approaches with Crystal Reports:

    Using the Crystal Reports report designer. This program must be used to design all reports, and it canprint them as well. This means you don't need to run a Visual Basic application to print reports on data

    maintained by your application. The program, however, can't be distributed to users of your

    application.

    Using Crystal Reports OLE custom control (OCX). This OCX is included in the package and can bedropped into a Visual Basic form to control report printing. The control gives your application access

    to most of the more useful features of the Crystal Reports program. With this control, you can have the

    report displayed in a Print Preview window, printed directly to a printer, or exported to a file.

    Which Report Engine Should I Use?

    With both Microsoft Data Reports and Crystal Reports included with Visual Basic 6, you havealternatives not previously available with Visual Basic. The tool you use will depend on your particular

    situation and personal preferences. You need to consider the reporting engines' different approaches to

    designing reports and how Visual Basic interfaces with the respective reporting engines.

    When to Use Microsoft Data Reports

    Data Reports integrates very well into the Visual Basic environment. The reports are generated

    directly in the Visual Basic IDE. There are no separate report files, and the report definitions are stored in an

    ActiveX designer form with the Visual Basic project. This means when a project is compiled, the reportdefinition is compiled within the executable file (EXE). The report retrieves the data to be used from a Data

    Connection within a Data Environment. This enables the report to retrieve data from this powerful new

    feature in Visual Basic 6.

    Leccion 10 Usando el DataReport Pgina 2

    http://popup%28%2709fig01.gif%27%29/http://popup%28%2709fig01.gif%27%29/http://popup%28%2709fig01.gif%27%29/http://popup%28%2709fig01.gif%27%29/http://popup%28%2709fig01.gif%27%29/
  • 8/2/2019 Leccion 10 - Usando El Data Report

    3/3

    VISUAL BASIC CON BASE DE DATOS IDSYSTEMS 2012

    Microsoft Data Reports integrates well with Visual Basic by using the new powerful Data

    Environment and enabling the programmer to create reports with similar methods in which forms are created.

    Data Reports is great for basic reports; however, it does not have the options oradvanced report features of the

    mature Crystal Reports and is not backward compatible with Crystal Report .RPT files.

    When to Use Crystal Reports

    Crystal Reports takes a totally different approach to creating reports to use with Visual Basic. Aseparate application creates the report definitions, and these reports are stored in a separate .RPT file that must

    be distributed with the EXE file. Also, additional DLLs and an OCX control must be included for the Visual

    Basic application to use a Crystal Reports report. The distribution requirements are therefore much heavier

    than those forMicrosoft Data Reports. Furthermore, a Crystal Reports report uses ODBC to connect to a data

    source, not to the new powerful Data Environment.

    Crystal Reports is much more mature that Microsoft Data Reports. Many applications have already

    been written using Crystal Reports as theirreporting engine. Also, Crystal Reports has a wider feature set than

    Data Reports. It can generate cross-tab reports and sub reports, and it has much more powerful formula and

    many number crunching features. Crystal Reports also has an upgradepath that provides new features and more

    power.Crystal is a mature and proven product. It might be heavier than Data Reports, but it offers a

    richer feature set and has upgrade options forscalability.

    CRYSTAL REPORTS UPGRADE OPTIONS

    Crystal Reports Professional 6

    This version of Crystal Reports includes an updated feature set to Crystal 4.6.1, which is

    included with Visual Basic. An updated report designer and an ISAPI module is included, which

    allows reports to be placed on a IIS Web server. Java, ActiveX, and pure HTML viewers can be

    used to display a report on the Web server. This version of Crystal Reports enables you to export

    a report in various formats including HTML, MS-Excel, MS-Word, and Lotus 1-2-3.

    Crystal Info

    Crystal Info is a server-based solution that enables multiple users to view, schedule, and

    manipulate shared reports. It

    can be used as a central storage for reports, for multiple users to view. It can be used to

    schedule when complex and time consuming reports will be run so data can be viewed without

    having to run the report each time. What SQL Server is to Microsoft Access,Crystal Info is to

    Crystal Reports.

    Crystal Report Designer

    This is an ActiveX designer that works in the same vein as Microsoft Data Reports. It

    gives you 100% functionality of Crystal Reports 6 with the Visual Basic IDE. Take the way

    Microsoft Data Reports integrates into Visual Basic and add the power of Crystal Reports 6.WOW! Prior to the release of Visual Basic 6, the only version of this tool available was for

    Visual Basic 5,but keep an eye on the Seagate Software Web site(www.seagatesoftware.

    com) for a Visual Basic 6 version.

    Leccion 10 Usando el DataReport Pgina 3

    http://www.seagatesoftware/http://www.seagatesoftware/http://www.seagatesoftware/http://www.seagatesoftware/http://www.seagatesoftware/