Application of VB5 Report Designer in Personnel management software

Source: Internet
Author: User
Tags command line

People who have used VB5 will give such praise-VB5 real cow! Indeed, Visual Basic 5.0 has attracted a host of programming fans with its powerful capabilities and exceptional development environment. The VB5 Chinese version of the culture is deeply loved by professionals and programming enthusiasts. The author chooses the VB5 Chinese version when designing the personnel resume management system for a unit. But in the design of the report encountered a problem, with the Printer object EndDoc method to achieve printing, output dozens of of different formats of the report is obviously too cumbersome. Maybe Miscrosoft company is aware of this, and finally I found that it provides us with an external report design tool in the VB5 Enterprise version of the add-in.

Open the VB5 menu select Add-ins \ Report Designer, and the report design interface is present in front of our eyes. May be the cause of the add-in, this is an English-language interface. Now the program requires you to register the user, the registration was found, this good dongdong has a nice name-Crystal report, and incredibly is the Seagate Software Information management company produced! Seagate (Seagate) hard drive everyone will not be unfamiliar, did not expect it will and Microsoft to cooperate. Talk less, and then look down.

There's a resume on hand. You need to print it to see how it implements direct printing of Access table data. First create a new report, select "New" in the menu immediately after the "Create report expert" (creating the Reporting Expert) window, and then just follow the prompts step by step. The expert will let you select the style of the report and then ask you to add the database file (such as Lvli.mdb) and the table data to be printed in the Library file (table). Wow! It also has a super connection to achieve multiple table printing. Then press "Next" and the expert then lets you choose the name of the field you want to print in the table. The sorting of records is an essential function of the report, and experts think of it for you. It can also help you add column statistics, define group and group totals, automatically generate page numbers, insert formula templates for complex calculations between fields, and more. All right, all set up, press "Report preview," and a report as you wish appears in front of you. What the? You're not satisfied? Never mind. Press the "Design" item, as in the word processing software, the WYSIWYG page appears. Each field name and text, like objects in VB, can move and change the font type and size.

It's cool! But not with VB program. Crystal Report has prepared its best partner for you-crystal ActiveX control. The Crystal ActiveX control is added to the VB5 control bar when you select "Engineering \ Part \crystal 4.6" in the VB5 menu. Put the Crystal ActiveX control into the form and write the report file name that you just generated to the control's Reportfilename property to complete the integration with the VB5 program. How do I start a report print in a program? It's easy to add a line of code to a mouse click event in an object like "button". That

private sub Command1_click()
crystalreport1.action=1
End Sub

When the program is running, the mouse clicks on the button on the form, the report immediately appears on the computer screen for you to preview, press the printer icon below the report, the Print dialog box appears, you can specify the scope of the printed page and print the number of sheets. Click on the "OK" button, a clear and complete resume report appears in front of you.

Indeed, Crystal Report Designer with its perfect function and good use of the interface to make up for the VB5 in the report printing deficiencies. With in-depth use, the author is more pleasantly surprised to find that using the Crystal ActiveX control can be combined with the data database control dynamic generation of reports! And you can define the format of the report before the dynamic report is generated! As we all know, the data source property of a control can accept a SELECT query statement from a table, a table query, or even a SQL language. If the data control can be bound to the crystal control, then the multiple query results with variables in the management software can be printed immediately. This has brought great convenience to programming. Here, I have to explore the format of the dynamic report of the establishment of the method dedicated to everyone. The steps are as follows:

1, add the Data Control, Crystal ActiveX Control and command button button on the form.

2. Set the database Name property and data Source property of the control.

3. For Crystal ActiveX controls:

(1) Set the report Source property to "3-crptdatacontrol".

(2) Open the property page for the control and select the data-bound report item.

(3) Select "Save Report as" to name and save the report that will be generated.

4, select "Add-ins \ Report Designer" in the VB5 menu, run the Crystal Report Designer, open the report file saved in step 3, edit the format as you want, such as fonts, colors, boxes, and so on. Save again after completion.

5, and then enter the VB5, set the Crystal ActiveX Control Report Source Property (ReportSource) is "0-crptreport", Report file Name property (Reportfilename) set to the saved report name in step 4.

6. Write the "crystalreport1.action=1" command line during the Click event procedure of the command button button.

Now, dynamic report creation complete, try to run it, how effective?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.