How to create complex reports using Access

Source: Internet
Author: User
Before reading this article, I would like to remind you that the Access reports are also very practical and powerful, use Excel to output reports only when you discover all of its functions but still cannot meet your special requirements on reports. Obviously, the first weakness of using Excel to output reports is that you must open both Access and Excel (

Before reading this article, I would like to remind you that the Access reports are also very practical and powerful, use Excel to output reports only when you discover all of its functions but still cannot meet your special requirements on reports. Obviously, the first weakness of using Excel to output reports is that you must open both Access and Excel (

Before reading this article, I would like to remind you that the Access reports are also very practical and powerful, use Excel to output reports only when you discover all of its functions but still cannot meet your special requirements on reports. Obviously, the first weakness of using Excel to output reports is that you must open Access and Excel at the same time (of course, you must install Access and Excel at the same time on a machine ), of course, if you have a CPU, 966 M memory, and a large-capacity hard disk that works at 256 MHz like you, you don't have to worry about it. Continue.

First, find the VBA programming interface, find the "tool" menu, and click "reference... "menu item, find the" existing reference "list in the pop-up" Reference "form, and check the box in front of the project named" Microsoft Excel x.0 Object Library.

Second, you need to prepare a blank Excel spreadsheet, set the display font, border, printing paper, and so on, and save it to the disk. (In the following example, the table name is "temp.xls".) Of course, you can directly use a blank Excel file, however, you need to program to automatically generate the table border, background color, cell format, and other content. This involves Excel programming. I will explain it in detail in the Excel column in the future. I will not talk about it here.

Then, you can create your own print preview form in Access, arrange two command buttons in the form, and enter the following code in the click Event of the button named preview:

Private Sub ExcelPreview_Click ()
Dim xlApp As Excel. Application
Dim xlBook As Workbook, xlSheet As Worksheet
Set xlApp = CreateObject ("Excel. Application ")
Set xlApp = New Excel. Application
XlApp. Visible = True
Set xlBook = xlApp. Workbooks. Open ("c: reprottemp.xls ")
Set xlSheet = xlBook. Worksheets (1)
XlSheet. Cells (3, 1) = "tabulation Date:" + "12" + "month"
'The above only changes the data in a cell and can be added as needed infinitely
XlBook. Save
XlSheet. PrintPreview
XlBook. close
XlApp. Quit
End Sub

,

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.