banner



How To Create Report Access

Home

Creating a Report

Report Design Fundamentals

Introduction

You can print data using a table or a form, but the favorite object to print records is the report. As mentioned in previous lessons, a report shares many characteristics with a form. Still, just like forms have some particular characteristcs, some aspects are uniques to reports.

Practical Learning: Introducing Reports

  1. Start Microsoft Access
  2. In the list of files, click College Park Auto-Repair1 from Lesson 23

Introduction to Report Creation

As we saw in Lesson 6, to quickly create a report, in the Navigation Pane, click a table to select it. Then, on the Ribbon, click Create. In the Reports section, click Report:

The Create Report Section of the Ribbon

Another fast way is by using the Report Wizard. To start it, in the Reports section of the Create tab of the Ribbon, click the Report Wizard button. This would launch a wizard that you can simply follow (we already saw how to use the Report Wizard in Lesson 3).

To start a report as blank piece of paper, on the Ribbon click Create. In the Reports section, click the Blank Report button. To create the types of labels that are sometimes glued on an envelop or a paper folder, click the Labels button on the Ribbon.

Opening a Report

Like a form, a report can be displayed in different views but the report has more varieties. If a report exists already, in the Navigation Pane, it is represented by a green icon Report Icon followed by the name of the report. The regular display of a report is called the Report View. To open a report whether it is currently closed or opened in a different view:

  • In the Navigation Pane, right-click its name and click Open
  • In the Navigation Pane, double-click the report

Like a form, once opened, a report is represented by a tab or a title bar (for an overlapped database) that displays its name. By its definition, a report is presented like a piece of paper. Therefore it uses a white background.

Introduction to Report Design

When it comes to report design, the rules to add and manipulate the controls are the same we reviewed for the form. We studied the techniques of control design from Lessons 6 and subsequent lessons. Although some of the issues concerned only forms, most of what involves design is the same for forms and reports.

Practical Learning: Starting a Report

  1. To start a new report, on the Ribbon, click Create
  2. In the Reports section, click Report Design

Field Insertion on Forms and Reports

Data on the controls of a form or report falls in three main categories: fields that directly originate from a table, an expression created as a combination of existing fields, and values independent of any field. Before or when creating a report, you can specify the table that holds the records. There are various ways you can do this. If you have already started a report and it is displaying in Design View but you did not yet select the table that holds the records, in the Data or the All tab of the Property Sheet of the report, click the arrow of the Record Source field and select the table from the list.

Practical Learning: Introducing Report Design

  1. Double-click the button at the intersection of the rulers to open the Property Sheet for the report
  2. In the Property Sheet, click the Data tab, click Record Source, then click the arrow of the combo box and select RepairOrders
  3. Right-click the title bar of the report and click Save
  4. Set the name of the report as RepairOrders and click OK

The Views of a Report

The Design View

To design a report, you must display it in Design View. To do this:

  • If the report is currently closed, in the Navigation Pane, right-click the report and click Design View
  • If the report is currently opened in a different view
    • In the Navigation Pane, right-click the report and click Design View
    • Right-click the tab or the title bar of the report and click Design View
    • In the status bar, click the Design View button
    • On the Ribbon and in the Home tab, click the arrow of the View button and click Design View

Here is an example of a(n empty) report in Design View:

Design View

As done for a form, in the Design View of a report, you can add, position, format, configure, and manipulate the necessary controls. Of course, you can also select objects from the Field List and add them to the report.

Practical Learning: Using the Design View of a Report

  1. In the Controls section of the Ribbon, click Add Existing Fields
  2. In the Field list, click ReceiptNumber
  3. Press and hold Shift
  4. Click ProblemDescription
  5. Release Shift
  6. Drag the selection to the Detail section of the report

The Print Preview

A good way to see what a printed report would look like is to preview it. Such a view is referred to as Print Preview. To preview a report:

  • If the report is currently closed, in the Navigation Pane, right-click the report and click Print Preview
  • If the report is currently opened in a different view
    • In the Navigation Pane, right-click the report and click Print Preview
    • Right the tab or the title bar of the report and click Print Preview
    • In the status bar, click the Print Preview button

When a report appears in Print Preview, the Ribbon is made of only one tab:

The Ribbon of a Print Preview Report

To appear realistic, a report in print preview appears like a piece of paper with margins. Its body is filled with the data that would be printed. Here is an example:

Report Print Preview

The right side and the bottom-right side may display a scroll bar each. Like a form in regular Form View, the Print Preview of a report is equipped with navigation buttons. The functionality of these navigation buttons is as we described for a table or form.

After using the Print Preview, to close it, in the Close Preview section of the Ribbon, click the Close Print Preview button Close Print Preview. This would display the report in the view it previously had.

Practical Learning: Checking the Print Preview of a Report

  1. Right-click the title bar of the report and click Print Preview.
    Notice the Ribbon
  2. To get out of the print preview, in the Close Preview section of the Ribbon, click the Close Print Preview button Close Print Preview

The Report View

The Report View shows a report with its controls and the items in its sections but it does not show the margins:

The Report View

To open a report in the Report View:

  • If the report is currently closed or opened in a different view:
    • In the Navigation Pane, right-click the report and click Open
    • In the Navigation Pane, double-click the report
    • In the Home tab of the Ribbon, click the View button Report View
  • If the rerport is currently opened in a different view:
    • Right-click the tab or the title bar of the report and click Report View
    • On the right side of the status bar, click the Report View button
    • If the rerport is currently displaying in the Layout View or in Print Preview (not in the Design View), right-click the body of the report and click Report View

Unlike the Print Preview, the Report View does not distinguish where a section starts and where it ends.

Practical Learning: Seeing the Report View

  • In the Navigation Pane, double-click the RepairOrders report

The Layout View

The Layout View of a report appears as a drawing board. It shows its title bar and its system buttons. In its body, it displays three dotted lines that represent the top section and the margins:

Layout View

Like a Design View, you can use the Layout View to add and manipulate controls on a report.

Practical Learning: Seeing the Layout of a Report

  1. Right-click the title bar of the report and click Layout View
  2. Right-click an unoccupied area of the report and click Design View
  3. Double-click the button at the intersection of the rulers to open the Property Sheet
  4. In the Property Sheet, click the Format tab

The Sections of a Report

The Page Header and the Page Footer Sections

As seen for a form, the Design View of a report can be equipped with one or more sections. By default, the primary section is the Page Header. The page header is equivalent to the top section of a printeg piece of paper.

If you create a report using either the Blank Report or the Report Design options of the Reports section of the Ribbon, the report is automatically equipped with a Page Header sections.

As mentioned previously, the Page Header represents the top section of the printed paper. Therefore, when designing a report, put in the Page Header the objects or text you want to display on each top part of the printed paper. For example, you can put the common title or the page number in that section. That section is also typically used to display the title of a brochure or book.

The Detail Section

Like a form, the most fundamental part of a report is the Detail section. It holds the most controls of a report. In fact, a report can have only that section. If you create a report using one of the options from the Reports section of the Create tab of the Ribbon, the report would come equipped with various sections. To have only the Detail section, you can right-click the report and click the option of the sections to remove. You may end up with only the Detail section:

The Detail section of a report

The Size of a Report

Like a form, a report has a size, which is the combination of its width and its height. When it comes to the height, each section has and controls its own vertical measure. As done for a form, to specify the height of a section:

  • You can drag up or down the bottom border of the bar of the next section

    Resizing the sections of a report

  • You can access the Property Sheet of that section and change the value of the Height property

As seen for a form, the height a report displays in Design View is the total height of its sections.

When it comes to the width of a report, all sections use the same measure. The width a report shows in Design View is the common width of its sections. Therefore, to specify the width of a report:

  • You can drag left or right the right border of any section

    Resizing a report

  • You can access the Property Sheet of the report and change the value of the Width property

To change both the height and the width of the report:

  • You can drag left, up, right, or down the bottom-right corner of the lowest section

    Resizing a report

  • You can access the Property Sheet of the report then change the values of both the Height and the Width fields

As seen for a form, you can specify any width youo want for a report, but this aspect is subject to the printer. Therefore, the width of a report should equal or narrower than a piece of paper (11" x 8.5"). If you set a width that is too high, Microsoft Access would warn you by displaying a green rectangle on the button at the intersection of the rulers:

The Width of a Report

Of course, the solution is to narrow the body of the report (to somewhere around Measure 8 of the horizontal ruler).

Practical Learning: Using the Detail Section of a Report

  1. On the report, click the button at the intersection of the rulers
  2. In the the Format tab of the Property Sheet, click Width and type 8
  3. Using what we learned in form/report design about moving, resizing, and formatting the controls, design the report as follows:

    College Park Auto-Repair - Report Design - Repair Orders

  4. Save the report

The Page Footer Section

A report can be equipped with a Page Footer. It represents the bottom part of a printed piece of paper. If you create a report using either the Blank Report or the Report Design button of the Ribbon, the report would automatically be equipped with a Page Footer section besides the Page Header side:

Design View

If you have a report that doesn't have these sections and you want to add them, right-click the report in Design View and click Page Header/Footer Page Header/Footer

Because the Page Footer represents the bottom part of each printed page, you can put on it the object(s) that would display on each page. For example, you can use it to display the date the report is being printed.

The Report Header

To create a book, a magazine, or a brochure, you may want to have a front cover. Such a section is handled by the Report Header section.

The Report Footer

If you are creating a report that should appear with many pages you may want the last page to have specific information or a particular design. To support thise, the report can be equipped with a Report Footer section. Normally, the Report Header and the Report Footer sections are added together:

A report equipped with the Report Footer, the Detail, and the Report Footer sections

If you create a report using either the Report or the Report Wizard options of the Reports section of the Ribbon, the report would be equipped with a Report Header and a Report Footer sections. If you have a report that doesn't have these sections and you want to add them, right-click the report in Design View and click Report Header/Footer Report Header/Footer.

As seen in the above screenshot, you can have a report that has a Report Header and a Report Footer sections without the Page Header and the Page Footer sections. If you have a Page Header and the Page Footer sections but don't want to show them on a printed paper, you can completely reduce their heights:

A report equipped with all sections

Otherwise, if you are creating a book or brochure that would represent a list of various items, you should equip it with all these five sections.

Reports and Windows Controls

Introduction

As mentioned when studying form and report design, when a report is in Design View, the Ribbon is equipped with a Controls section in its Design tab:

Fields

Some controls are not available for the report because such controls don't have any role in a report. An example is the Web Browser. Some other controls are available but you should really decide if you need them and why. Examples are the buttons (the Button and the Toggle Button) and the Attachment. Other than that, you can use the controls from the Ribbon to populate your report.

Practical Learning: Using the Page Header of a Report

  1. In the Controls section of the Ribbon, click the Label control Label and click below the Page Header of the report
  2. Type College Park Auto-Repair and press Enter
  3. In the Property Sheet, change the following characteristics:
    Top: 0
    Left: 2.0833
    Font Name: Bodoni MT Black (if you don't have that font, select Times New Roman)
    Font Size: 24
    Fore Color: #0072BC
  4. Double-click one of the borders of the label to resize it to fit its caption
  5. In the Controls section of the Ribbon, click the Line control Line and click in the Page Header section
  6. In the Property Sheet, change the following characteristics:
    Top: 0.42
    Left: 1.125
    Width: 6
  7. In the Controls section of the Ribbon, click the Line control Line and click in the Page Header section
  8. In the Property Sheet, change the following characteristics:
    Top: 0.4583
    Left: 0.25
    Width: 7.5
    Border Width: 2 pt
  9. Add a horizontal line Line below each row of text in the Detail section:

    College Park Auto-Repair - Report Design - Repair Orders

  10. In the Controls section of the Ribbon, click the Option Group Option Group and click the Detail ection of the report.
    If the wizard comes up, click Cancel
  11. Change the caption of the head label as Order Identification and make it cover the other controls

    College Park Auto-Repair - Report Design - Repair Orders

  12. Save the report

The Date and Time

If you want to show the current date and/or time on a report, use the Date and Time control Date and Time from the Controls section of the Ribbon. We reviewed in Lesson 14 how to use it.

Practical Learning: Displaying DateTime on a Form

  1. In the Controls section of the Ribbon, click the Text Box Text Box and click the left side of the Page Report section
  2. Click the accompanying label and press Delete
  3. Click the newly added text box
  4. In the Property Sheet, click the All tab and change the following characteristics:
    Name: txtDateTime
    Control Source: =Now()
    Format: dddd ", "mmmm dd", "yyyy" at "hh:nn:ss
    Width: 4
    Top: 0.0417
    Left: 3
    Top: 0.0833
    Back Style: Transparent
    Border Style: Transparent
    Font Name: Times New Roman
    Font Size: 12
    Text Align: Left
  5. Save the report

The Page Number

In a report meant to display various records on its many pages, you may want to display the page number. To do this, in the Controls section of the Design tab of the Ribbon, click Page Numbers Page Numbers and click the report. The Page Numbers dialog box would come up. Use the Page Numbers dialog box to specify what sentence would be used, and where, to display the page number. Once you are ready, click OK. The new label would be added to the Page Footer section of the report.

Practical Learning: Showing the Page Number on a Report

  1. In the Header/Footer section of the Ribbon, click the Page Numbers button Page Numbers
  2. In the Page Numbers dialog box, accept the Format and the Positions selections.
    Click the arrow of the combo box and select Right

    The Page Numbers Dialog Box

  3. Click OK
  4. Move the newly added text box to the Page Footer section

    College Park Auto-Repair - Report Design - Repair Orders

  5. Close the report
  6. When asked whether you want to save, click Yes

Tabular Reports

Unlike a form, a report is primarily considered in a tabular layout. This is because a report is primarily equipped with Page Header section. If you position some controls, such as labels, on it, and add the necessary controls, such as text boxes and combo boxes, in the Detail section, the report would behave like a tabular form, that is, a continuous view of records. You can use this feature of reports to create a tabular report without having to configure it in the Property Sheet, as done form the form.

Probably the easiest way to create a tabular report is to use the Report Wizard. If you start the wizard, in its fourth page, the Tabular layout is selected by default. When you end the wizard, the labels would be automatically positioned in the Page Header section and the text boxes would be added to the Detail section.

Practical Learning: Creating a Tabular Report

  1. On the Ribbon, click File and click Open
  2. In the list of files, click StatesStatistics2 from Lesson 24
  3. On the Ribbon, click Create
  4. In the Reports section, click Report Design
  5. In the Property Sheet, click the Data tab and set the Record Source to States
  6. Save the report as Summary
  7. In the Tools section of the Ribbon, click Add Existing Fields
  8. In the Field List, double-click Abbreviation, StateName, AreaSqrMiles, AreaSqrKms, AdmissionUnionDate, AdmissionUnionOrder, Capital and Region
  9. Press Ctrl + A to select everything on the report

    States Statistics - Report Design

  10. On the Ribbon, click Arrange and click Tabular
  11. Click and hold the cross button on the left side of the labels in the Page Header section
  12. Drag to the left

    States Statiistics - Report Design

  13. Click an unoccupied area of the report to dismiss the selection
  14. Drag the Abbreviation text tox to the top

    States Statiistics - Report Design

  15. Press Ctrl + A to select everything on the report
  16. On the Ribbon, click Remove Layout
  17. Click inside the vertical rulers on the left side of the Detail section to select the text boxes
  18. On the Ribbon, click Format
  19. In the Control Formatting section of the Ribbon, click the arrow of the Shape Fill button and select Transparent
  20. In the Control Formatting section of the Ribbon, click the arrow of the Shape Outline button and select Transparent
  21. On the Ribbon, click Design
  22. In the Controls section of the Ribbon, click the Label control Label , click the Page Header section, and type Area and press Enter
  23. In the Controls section of the Ribbon, click the Label control Label , click the Page Header section, and type Union to Union and press Enter
  24. Press Ctrl + A to select everything on the report
  25. On the Ribbon, click Format
  26. While the controls are still selected, in the Font section of the Ribbon, in the Font combo box, select Garamond (otherwise, select Times New Roman)
  27. In the Font Size combo box, select 12
  28. Position the controls as follows:

    States Statiistics - Report Design

  29. In the Controls section of the Ribbon, click the Line control Line and click in the Page Header section
  30. Position the line below the Area label
  31. In the Controls section of the Ribbon, click the Line control Line and click in the Page Header section
  32. Position the line below the Admission to Union label
  33. In the Controls section of the Ribbon, click the Line control Line and click in the Page Header section
  34. Position the line just above the Detail bar and set it width to 2pt
  35. In the Controls section of the Ribbon, click the Line control Line and click in the Page Header section
  36. Position the line below the text boxes in the Detail section
  37. Complete the design of the report as follows:

    States Statiistics - Report Design

  38. Save the report

Sub-Reports

As you may know already, a sub-report is just a smaller version of a report, except that a sub-report is made to be displayed in the body of a report. And as you may know already, a sub-report is created in a tabular layout. The easiest way to create a report and its sub-report is by using the Report Wizard. Otherwise, you can create and design your sub-report any way you like.

When designing a sub-report, the controls that will be displayed on top should be positioned in the Report Header section. Then you can either completely shrink the Page Header and the Page Footer sections or you can remove them.

After creating a sub-report, you can add it to a report. Remember that, as seen for sub-forms, both the report and the sub-report must hold a relationship in which the report has a primary key field and the sub-report has the equivalent foreign key.

Practical Learning: Creating and Using a Sub-Report

  1. On the Ribbon, click File and click Open
  2. In the list of files, click College Park Auto-Repair1
  3. On the Ribbon, click Create and click Report Design
  4. In the All tab of the Property Sheet, set the Record Source to PartsUsed
  5. Save the report as srPartsUsed
  6. In the Tools section of the Ribbon, click Add Existing Fields
  7. In the Field list, double-click PartName, UnitPrice, and Quantity to add them to the report
  8. Double-click the button at the intersection of the rulers of the report
  9. In the Controls section of the Ribbon, click the Text Box Text Box and click in the Detail section of the report
  10. In the Property Sheet, click the All tab and change the following characteristics:
    Name: txtSubTotal
    Control Source: =[UnitPrice]*[Quantity]
    Format: Fixed
  11. Change the caption of the accompanying label to Sub-Total and press Enter
  12. On the Ribbon, click the Line
  13. Draw a horizontal line below the labels in the Report Header section
  14. On the Ribbon, click the Line Line
  15. Draw a horizontal line below the text boxes in the Detail section
  16. In the Controls section of the Ribbon, click the Text Box Text Box and click the Report Footer section
  17. In the Property Sheet, click the All tab and change the following characteristics:
    Name: txtSubTotals
    Control Source: =Sum([UnitPrice]*[Quantity])
  18. Complete the design of the report as follows:

    College Park Auto-Repair - Sub-Report Design - Jobs Performed

  19. Save and close the report
  20. In the Navigation Pane, right-click the RepairOrders report and click Design View
  21. From the Navigation Pane, drag srPartsUsed and drop it on an unoccupied area of the report
  22. In the Controls section of the Ribbon, click the Option Group Option Group and click the Detail ection of the report.
    If the wizard comes up, click Cancel
  23. Change the caption of the head label as Parts Used
  24. Position the group box so ther controls

    College Park Auto-Repair - Report Design - Repair Orders

  25. On the Ribbon, click Create and click Report Design
  26. In the Property Sheet, set the Record Source to JobsPerformed
  27. Save the report as srJobsPerformed
  28. In the Tools section of the Ribbon, click Add Existing Fields
  29. In the Field list, double-click JobName and Cost to add them to the report
  30. On the Ribbon, click the Design tab and click the Line Line
  31. Draw a horizontal line in the Report Header section
  32. On the Ribbon, click the Line Line
  33. Draw a horizontal line in the Detail section
  34. In the Controls section of the Ribbon, click the Text Box and click the Report Footer section
  35. In the Property Sheet, click the All tab and change the following characteristics:
    Name: txtJobPrices
    Control Source: =Sum(Nz([Cost]))
  36. Complete the design of the report as follows:

    College Park Auto-Repair - Sub-Report Design - Jobs Performed

  37. Save and close the sub-report
  38. In the same way, drag srPartsUsed and drop it on an unoccupied area of the report
  39. In the Tools section of the Ribbon, click Add Existing Field
  40. In the Field list, click DropOfDateTime
  41. Press and hold Ctrl
  42. Click , OrderCompletedDateTime, TaxRate, and Recommendations
  43. Release Ctrl
  44. Drag the selection to an empty area on the report
  45. In the Controls section of the Ribbon, add a Text Box Text Box to the form
  46. In the Property Sheet, change its characteristics as follows:
    Name: txtTotalParts
    Control Source: =Nz([srPartsUsed].Report!txtSubTotals)
    Format: Fixed
  47. Change the caption of the accompanying label to Total Parts:
  48. From the Controls section of the Ribbon, add a text box to the form
  49. In the Property Sheet, change its characteristics as follows:
    Name: txtTotalLabor
    Control Source: =Nz([srJobsPerformed].[Report]![txtCosts])
    Format: Fixed
  50. Change the caption of the accompanying label to Total Labor:
  51. From the Controls section of the Ribbon, add a text box to the form
  52. In the Property Sheet, change its characteristics as follows:
    Name: txtTaxAmount
    Control Source: =CLng(CCur(Nz([txtTotalParts])+Nz([txtTotalLabor]))*CDbl([TaxRate])*100)/100
    Format: Fixed
  53. Change the caption of the accompanying label to Tax Amount:
  54. From the Controls section of the Ribbon, add a text box to the form
  55. In the Property Sheet, change its characteristics as follows:
    Name: txtOrderTotal
    Control Source: =CCur(Nz([txtTotalParts]))+CCur(Nz([txtTotalLabor]))+CCur(Nz([txtTaxAmount]))
    Format: Fixed
  56. Change the caption of the accompanying label to Order Total:
  57. Format the controls to appear like the others:

    College Park Auto-Repair - The Nz() Function

  58. Save and close the form
  59. The RepairOrders form should still be opened in Design View.
    In the Controls section of the Ribbon, click the Text Box control and click below the date-based controls that were previously added
  60. Change the caption of the accompanying label to Repair Duration:
  61. Click the text box to select it
  62. In the Property Sheet, click the All tab and change following characteristics:
    Name: txtRepairDuration
    Control Sourcce: =DateDiff("n",[DropOffDateTime],[OrderCompletedDateTime]) & " Minutes"
  63. Click OK
  64. Format the design of the label and the text box to appear like the other controls:
  65. From the Controls section of the Ribbon, add 3 text boxes Text Box
  66. Using the Property Sheet, change their characteristics as follows:
    Associated Label - Caption Text Box Name Control Source
    The car was in repair for: txtDays =IIf(DateDiff("n",[DropOffDateTime],[OrderCompletedDateTime])\1440=0,"",IIf(DateDiff("n",[DropOffDateTime],[OrderCompletedDateTime])\1440=1,DateDiff("n",[DropOffDateTime],[OrderCompletedDateTime])\1440 & " day",DateDiff("n",[DropOffDateTime],[OrderCompletedDateTime])\1440 & " days"))
    Delete txtHours =IIf((DateDiff("n",[DropOffDateTime],[OrderCompletedDateTime])\60) Mod 24=0,"",IIf((DateDiff("n",[DropOffDateTime],[OrderCompletedDateTime])\60) Mod 24=1,(DateDiff("n",[DropOffDateTime],[OrderCompletedDateTime])\60) Mod 24 & " hour",(DateDiff("n",[DropOffDateTime],[OrderCompletedDateTime])\60) Mod 24 & " hours"))
    Delete txtMinutes =IIf(DateDiff("n",[DropOffDateTime],[OrderCompletedDateTime]) Mod 60=0,"",IIf(DateDiff("n",[DropOffDateTime],[OrderCompletedDateTime]) Mod 60=1,DateDiff("n",[DropOffDateTime],[OrderCompletedDateTime]) Mod 60 & " minute",DateDiff("n",[DropOffDateTime],[OrderCompletedDateTime]) Mod 60 & " minutes"))
  67. Format the controls to appear like the others

    Aollege Park Auto-Repair - Report Design - Expressions

  68. Close the report
  69. When asked whether you want to save, click Yes
  70. Open the Ceil Inn1 database from the Lesson 20
  71. On the Ribbon, click Create and click Report Design
  72. Double-click the button at the intersection of the rulers
  73. In the Property Sheet for the report, click the All tab and change the following properties:
    Record Source: Occupancies
    Width: 5
  74. Save the report as srOccupancies
  75. In the Tools section of the Ribbon, click Add Existing Fields Field List
  76. In the Field List, double-click DateOccupied, RoomNumber, RateApplied, and PhoneCharge
  77. Complete the design of the sub-report as follows:

    Ceill Inn - Sub-Report Design - Occupancies

  78. Save and close the report

Printing a Report

Introduction

After creating a report, you have many ways to print it. The fastest option consists of sending the report directly to the printer. To do this:

  • In the Navigation Pane, right-click the report and click Print...
  • CClick File and click Print. This would display a window with three options:

Print

To send the document directly to the printer, click Quick Print.

Automating Printing

To make it easy for users to print a report, you can add a button on a form so that the user can click that button to initiate printing. probably the best way to do this is to use the Command Button Wizard to create the button.

Practical Learning: Printing the Records

  1. In the Navifation Pane, right-click the RepairOrders form and click Design View
  2. In the Controls section of the Ribbon, click the Button Button and click in the Form Footer section on the left side of the Close button
  3. In the first page of the wizard, in the left list, click Report Operations
  4. In the right list, click Print Report

    Command Button Wizard

  5. Click Next
  6. In the second page of the wizard, make sure the RepairOrders report is selected and click Next
  7. Click Print Record and change it to Print all Repair Orders

    Command Button Wizard

  8. Click Next
  9. Change the name of the button to cmdPrintAllRecords
  10. Click Finish
  11. Right-click the title bar of the form and click Form View
  12. Click the Print all Repair Orders button

The Print Dialog Box

The Print dialog box is the most regular object used to send a document to the printer. To display it:

  • Click File and click Print. In the window that appears, click Print
  • Use the Print Preview. In the Print section of the Ribbon, click the Print button

Any of these actions would display the Print dialog box:

The Print Dialog Box Button Wizard

If a report contains many records:

  • To print all of them, in the Print dialog box, accept or click the All button
  • To print a specific record, click the From text box and type number of the record
  • To print a range of records, click the From box, type the starting range. Click the To text box and type the end number of the range

After making the selection, click OK on the Print dialog box.

Practical Learning: Printing the Records

  1. In the Print dialog box, click OK
  2. Right-click the title bar of the form and click Design View.

Printing a Specific Record

In a transaction-based application, a user usually wants to print only the record he or she is viewing from a form. You can assist the user with a macro. When creating the macro, you have to specify the condition by which the record would be selected.

To proceed, start a normal macro:

  • In the Add New Action combo box, select Open Report
  • In the Action Catalog window, expand Actions and expand Database Objects. Drag OpenReport and drop in the left window

You must specify the name of the report in the Report Name combo box. To create the condition that specifies how to locate the record to print, write an expession or use the Expression Builder to create it.

Practical Learning: Printing a Record

  1. In the Controls section of the Ribbon, click the Button Button.
    If the wizard comes up, click Cancel
  2. In the Property Sheet, click the All if necessary and change the following characteristics for the button:
    Name: cmdPrintRepairOrder
    Caption: Print Current Repair Order
  3. Click On Click, then click its ellipsis button Browse
  4. In the Choose Builder dialog box, make sure Macro Builder is selected and click OK
  5. Click the arrow of the Add New Action combo box and select OpenReport
  6. Click the arrow of the Report Name combo box and select RepairOrders
  7. Click the arrow of the View combo box and  select PrintPreview
  8. Click the button on the other side of the Where Condition = text box
  9. In the middle list of the Expression Builder, double-click ="[ReceiptNumber] = " & [ReceipNumber] (this expression means "Find the record where the ReceiptNumber (on the report) is equal to the current ReceiptNumber (on this form")

    Macro to Print

  10. On the Ribbon, click the Close button
  11. When asked whether you want to save the macro, click Yes
  12. Select all three buttons in the Form Footer section
  13. On the Ribbon, click Format
  14. In the Control Formatting section, click Quick Styles and click Subtle Effect, Gray, Accent 3 (4th column, 4th row)

    College Park Auto-Repair - Form Design - Printing Configuration

  15. Right-click the title bar of the form and click Form View
  16. Navigate to the third record
  17. Click the Print Current Repair Order button
  18. On the dialog box, click OK
  19. Click the Close button to close the form
  20. When asked whether you want to save, click Yes
  21. Close Microsoft Access

How To Create Report Access

Source: http://www.functionx.com/access/Lesson27.htm

Posted by: hubbardandome.blogspot.com

0 Response to "How To Create Report Access"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel