Friday, April 7, 2017

Modify, edit, or change a report

Modify, edit, or change a report

This topic describes the techniques you can use to modify an existing report. Microsoft Office Access 2007 provides two views that you can use to make changes to your report: Layout view and Design view. Your choice of which view to use depends on what specific task you are trying to accomplish. You might end up using both views to make your changes.

What do you want to do?

Understand Layout view

Understand Design view

Switch between views

Modify your report in Layout view

Modify your report in Design view

Understand Layout view

Layout view is the most intuitive view to use for report modification, and can be used for nearly all the changes you would want to make to a report in Office Access 2007. In Layout view, the report is actually running, so you can see your data much as it will appear when printed. However, you can also make changes to the report design in this view. Because you can see the data while you are modifying the report, it's a very useful view for setting column widths, add grouping levels, or performing almost any other task that affects the appearance and readability of the report. The following illustration shows the Customer Phone Book report in Layout view.

Report in Layout view

The report you see in Layout view does not look not exactly the same as the printed report. For example, there are no page breaks in Layout view. Also, if you have used Page Setup for format your report with columns, the columns are not displayed in Layout view. However, Layout view gives you a very close approximation of the printed report. If you want to see how the report will look when printed, use Print Preview.

Certain tasks cannot be performed in Layout view, and require you to switch to Design view. In certain situations, Access will display a message telling you that you must switch to Design view to make a particular change.

Top of Page

Understand Design view

Design view gives you a more detailed view of the structure of your report. You can see the header and footer bands for the report, page, and groups. The report is not actually running in Design view, so you cannot see the underlying data while working; however, there are certain tasks you can perform more easily in Design view than in Layout view. You can:

  • Add a wider variety of controls to your report, such as labels, images, lines, and rectangles.

  • Edit text box control sources in the text boxes themselves, without using the property sheet.

  • Change certain properties that are not available in Layout view.

The following illustration shows the Customer Phone Book report in Design view.

A report in Design view

Top of Page

Switch between views

Access provides a variety of methods for switching between views. If the report is already open, you can switch to another view by doing one of the following:

  • Right-click the report in the Navigation Pane, and then click the view you want on the shortcut menu.

  • Right-click the report's document tab or title bar, and then click the view you want on the shortcut menu.

  • On the Home tab, in the View group, click the View button to toggle between available views. Alternatively, you can click the arrow under View, and then select one of the available views from the menu. Print Preview is not available on this menu.

    Access Ribbon Image

  • Right-click in a blank area of the report itself, and then click the view you want. If the report is open in Design view, you must right-click outside of the design grid.

  • Click one of the small view icons on the Access status bar.

If the report is not open, double-click the report in the Navigation Pane to open it in Report view. To open the report in another view, right-click the report in the Navigation Pane and then click the view you want on the shortcut menu.

Note: If you are modifying a report in which you have used Page Setup to create multiple columns (for example, a mailing label report), you can only view the columns in Print Preview. When you view the report in Report view or Layout view, Access displays the data in a single column.

Top of Page

Modify your report in Layout view

This section describes some of the common report modifications that you can perform in Layout view.

Change column or field width

Change row or field height

Add a field

Understand control layouts

Delete a field or column

Change page setup

Change the formatting of a field

Bind a text box to a different field (change the control source of a control)

Change the record source of the report

Wrap text in a field

Add gridlines

Add or modify a logo or other image

Add or edit a report title

Add page numbers, the current date, or the current time

Change column or field width

  1. Click an item in the column that you want to adjust.

    A border is drawn around the item to indicate that the field is selected.

  2. Drag the right or left edge of the border until the column is the width you want.

Top of Page

Change row or field height

  1. Click an item in the row that you want to adjust.

    A border is drawn around the item to indicate that the field is selected.

  2. Drag the top or bottom edge of the border until the row is the height you want.

Top of Page

Add a field

  • On the Format tab, in the Controls group, click Add Existing Fields. Button image

    The list of available fields is displayed. If there are fields available in other tables, these will be displayed under Fields available in other tables:.

  • Drag a field from the Field List onto the report. As you move the field, a highlighted area will indicate where the field will be placed when you release the mouse button.

    Note: To add multiple fields at once, hold down the CTRL key and click each field in the Field List that you want. Then, release the CTRL key and drag the fields onto the report. The fields will be placed adjacent to each other.

Top of Page

Understand control layouts

Control layouts are guides that align your controls horizontally and vertically to give your report a uniform appearance. You can think of a control layout as a table, where each cell of the table contains a control. The following procedures show you how to add, remove, or rearrange controls in control layouts.

Control layouts come in two varieties: tabular and stacked.

  • In tabular control layouts, controls are arranged in rows and columns like a spreadsheet, with labels across the top. Tabular control layouts always span two sections of a report; whichever section the controls are in, the labels are in the section above them. The following illustration shows a basic tabular control layout.

    Basic tabular control layout

  • In stacked layouts, controls are arranged vertically like you might see on a paper form, with a label to the left of each control. Stacked layouts are always contained within a single report section. The following illustration shows a basic stacked control layout.

    Basic stacked control layout

You can have multiple control layouts of either type on a report. For example, you might have a tabular layout to create a row of data for each record, and then one or more stacked layouts underneath, containing more data from the same record.

Create a new control layout

Access automatically creates columnar control layouts in the following circumstances:

  • You create a new report by clicking Report Button image in the Reports group on the Create tab.

  • You create a new report by clicking Blank Report Button image in the Reports group on the Create tab, and then dragging a field from the Field List pane to the report.

On an existing report, you can create a new control layout by doing the following:

  1. Select a control that you want to add to the layout.

  2. If you want to add other controls to the same layout, hold down the SHIFT key and also select those controls.

  3. Do one of the following:

    • On the Arrange tab, in the Control Layout group, click Tabular Button image or Stacked Button image .

    • Right-click the selected control or controls, point to Layout, and then click Tabular Button image or Stacked Button image .

Access creates the control layout and adds the selected controls to it.

Switch a control layout from tabular to stacked, or from stacked to tabular

To switch an entire layout from one type of layout to the other:

  • Select the control layout by clicking the orange layout selector at the top left corner of the layout.

    All the cells in the layout are selected.

  • Do one of the following:

    • On the Arrange tab, in the Control Layout group, click the layout type you want (Tabular Button image or Stacked Button image ).

    • Right-click the control layout, point to Layout, and then click the layout type you want.

Access rearranges the controls into the layout type you selected.

Split one control layout into two layouts

You can split a control layout into two layouts by using the following procedure:

  1. Hold down the SHIFT key and click the controls you want to move to the new control layout.

  2. Do one of the following:

    • On the Arrange tab, in the Control Layout group, click the layout type you want for the new layout (Tabular Button image or Stacked Button image ).

    • Right-click the selected controls, point to Layout, and then click the layout type you want for the new layout.

Access creates a new control layout and adds the selected controls to it.

Rearrange controls in a control layout

  • You can move a control within a control layout by dragging it to the location you want. As you drag the field, a horizontal or vertical bar indicates where it will be placed when you release the mouse button.

  • You can move a control from one control layout to another control layout of the same type. For example, you can drag a control from one stacked layout to another stacked layout, but not to a tabular layout.

Add controls to a control layout

To add a new field from the Field List pane to an existing control layout    

  • Simply drag the field from the Field List pane to the layout. A horizontal or vertical bar indicates where the field will be placed when you release the mouse button.

To add existing controls to an existing control layout    

  1. Select the first control that you want to add to the control layout.

  2. If you want to add other controls to the same layout, hold down the SHIFT key and also select those controls. You can select controls in other control layouts.

  3. Do one of the following:

    • If the report is open in Design view, drag the selected fields to the layout. A horizontal or vertical bar indicates where the fields will be placed when you release the mouse button.

    • If the report is open in Layout view:

      1. On the Arrange tab, in the Control Layout group, click the type of the layout you are adding to. If you are adding to a tabular layout, clickTabular. If you are adding to a stacked layout, clickStacked.

        Access creates a new layout and adds the selected controls to it.

      2. Drag the new layout to the existing layout. A horizontal or vertical bar indicates where the fields will be placed when you release the mouse button.

Remove controls from a control layout

Removing a control from a control layout allows you to place it anywhere on the report without affecting the positioning of any other controls.

  • Select the control you want to remove from the layout. To select multiple controls, hold down the SHIFT key and then click the controls that you want to remove. To select all of the controls in the layout, click the layout selector box at the top left corner of the layout.

  • Do one of the following:

    • On the Arrange tab, in the Control Layout group, click Remove Button image .

    • Right-click one of the selected controls, point to Layout, and then click Remove.

      Access removes the selected controls from the layout.

Tip: To prevent a control from being inserted into a control layout as you move it, press and hold the CTRL key, and then drag the control to where you want it.

Top of Page

Delete a field or column

  1. Click the field or column to be deleted, or click its label or column heading.

    Access draws a border around the item to indicate that it is selected.

  2. Press DELETE.

Top of Page

Change page setup

Use the Page Layout group on the Page Setup tab to change size, orientation, margins, and so on.

  1. Click the Page Setup tab.

  2. In the Page Layout group, click Size Button image to select a different paper size.

  3. Click Portrait Button image or Landscape Button image to change the paper orientation.

  4. Click Margins Button image to make adjustments to the report's margins.

Top of Page

Change the formatting of a field

  1. Select the field that you want to format.

  2. On the Format tab, use the tools in the Font group to apply the formatting you want.

    Access Ribbon Image

Top of Page

Bind a text box to a different field (change the control source of a control)

  1. Click inside the column or the field for which you want to change the control source.

    A border is drawn around the item to indicate that the field is selected.

  2. If the property sheet is not currently displayed, press F4 to display it.

  3. On the Data tab of the property sheet, set the ControlSource property to the new field. You can either select a field from the drop-down list, or you can type an expression in the box. Find links to more information about expressions in the See Also section of this article.

Top of Page

Change the record source of the report

  1. If the property sheet is not displayed, press F4 to display it.

  2. In the drop-down list at the top of the property sheet, click Report.

  3. In the property sheet, click the Data tab.

  4. In the Record Source drop-down list, select the table or query that you want to use for a record source, or click Builder button to display the Query Builder.

    Note: If the report is currently based on a table, Access asks if you want to create a query based on the table. Click Yes to display the Query Builder and create the query, or click No to cancel the operation. If you choose to create a query, the new query will become the record source of the report. It will be created as an "embedded" query — that is, a query that is stored in the report's RecordSource property, rather than as a separate query object.

Top of Page

Wrap text in a field

  1. If the property sheet is not displayed, right-click the field in which you want the text to wrap, and click Properties. Otherwise, just click the field to select it.

  2. On the Format tab of the property sheet, set the CanGrow property toYes.

Top of Page

Add gridlines

If your controls are contained in a control layout, you can add gridlines to provide more visual separation between the controls. For more information about control layouts, see the section Work with control layouts.

  1. Click any field in a control layout.

    A border is drawn around the field to indicate that it is selected.

  2. On the Format tab, in the Gridlines group, click Gridlines.

    Access Ribbon Image

  3. Select the style of gridlines you want.

Note: You can also add gridlines by right-clicking any field in a control layout, pointing to Layout, pointing to Gridlines , and then selecting the type of gridlines you want.

Top of Page

Add or modify a logo or other image

The following procedures show you how to add a logo to a report by using the Logo tool, and how to resize an image control or an image inside an image control.

Add a logo

  • On the Format tab, in the Controls group, click Logo. Button image

    The Insert Picture dialog box is displayed.

  • Browse to the folder where your logo file is stored, and double-click the file.

    Access adds the logo to the upper left corner of the report.

Resize a control that contains a logo or other image

  1. Click the control that contains the image.

    A border is drawn around the control to indicate that it is selected.

  2. Place the pointer on the border. When the pointer becomes a double-headed arrow, you can drag it in the directions indicated by the arrows to make the image control larger or smaller.

Note that the default value for the Size Mode property of an image is Clip, meaning that the image will stay the same size regardless of how large or small you make the image control. If you want the image to get larger or smaller as you resize the control, do the following:

Resize the logo or image inside the control

  1. Select the image.

  2. If the property sheet is not already displayed, press F4 to display it.

  3. On the Format tab of the property sheet, set the Size Mode property to the option you want:

Setting

Description

Clip

The image stays the same size, regardless of how large or small you make the image control. If you make the image control smaller than the image, the image is clipped.

Stretch

The image is stretched both vertically and horizontally to match the size of the image control. The original aspect ratio of the image is not preserved, so this setting can result in a distorted image unless you precisely set the height and width of the image control.

Zoom

As the image control is resized, the image adjusts to be as large as possible without affecting the original aspect ratio of the image.

Top of Page

Add or edit a report title

The following procedures show you how to add or edit a label containing the report's title.

Add a title to a report

  • On the Format tab, in the Controls group, click Title. Button image

    A new label is added to the report header, and the report name is entered for you as the report title.

  • When the label is created, the text in the label is selected for you so that if you want to change the text, you can just begin typing the title you want.

  • Press ENTER when you have finished.

Edit the report title

  1. Double-click the label containing the report title to place the cursor in the label.

  2. Type the text you want to use as the report title, and press ENTER when you have finished.

Top of Page

Add page numbers, the current date, or the current time

The following procedures show you how to add page numbers to a report, and how to add the current date or the current time.

Add page numbers

  • On the Format tab, in the Controls group, click Page Numbers. Button image

    The Page Numbers dialog box is displayed.

  • Choose the format, position, and alignment you want for the page numbers.

  • Clear the Show Number of First Page check box if you do not want a number on the first page.

  • Click OK.

    The page numbers are added to the report. Switch to Print Preview to see how the numbers will look when you print the report.

Add the date or time

  • On the Format tab, in the Controls group, click Date and Time. Button image

    The Date and Time dialog box is displayed.

  • Clear the Include Date check box if you do not want to include the date.

  • If you want to include the date, click the date format you want.

  • Clear the Include Time check box if you do not want to include the time.

  • If you want to include the time, click the time format you want.

    A sample of the date and time, in the formats you have chosen, appears in the Sample area of the dialog box.

  • Click OK.

Top of Page

Modify your report in Design view

In some cases, you cannot perform certain modifications to your report in Layout view, and must instead use Design view.

Add line numbers

  1. On the Design tab, in the Controls group, click Text Box Button image .

  2. Click in an open area of the section where you want the line numbers to appear. In most cases, this will be the Detail section. You will move the text box to its final location later.

    When you click the report, Access creates a new, unbound text box.

  3. Click the label (just to the left of the new text box), and press DELETE.

  4. Click once in the new text box to select it, and then click again to position the cursor in the text box.

  5. Type =1 and then press ENTER.

  6. If the property sheet is not already displayed, press F4 to display it.

  7. On the Data tab of the property sheet, set the Running Sum property to Over All.

    Note: If this is a grouped report, and you want the numbering to start at 1 for each group, set the property to Over Group.

  8. Resize the text box to a smaller width by positioning the pointer over the sizing handle on the right edge of the text box and dragging it to the left. Leave enough room for the largest line number you expect to see on this report.

  9. If needed, make room for the text box on the far left edge of the Detail section by dragging the existing controls in that section to the right, or by resizing the leftmost control in that section.

  10. Drag the new text box to the location that you want it on the report.

  11. Switch to Report view, Print Preview, or Layout view to see the line numbers.

Make a group header appear at the top of each page

For groups that span multiple pages, it is helpful to have the group header appear at the top of each page so that you can easily see which group the data are in. You can select a group header in Layout view, but it is easier to do this in Design view.

  1. Double-click the group header section selector (the horizontal bar above the group header section).

  2. On the Format tab of the property sheet, set the Repeat Section property to Yes.

Open a subreport in its own Design view window

When you open a report in Design view, any subreports contained on the report are also opened in Design view. However, each subreport is displayed inside its subreport control, not as a separate window. Since the subreport control is often too small to work in easily, it is usually more convenient to open the subreport in its own window and then edit it. To open a subreport in a new window, do one of the following:

  • Select the subreport, and then on the Design tab, in the Tools group, click Subreport in New Window Button image .

  • Click once outside of the subreport control to make sure that it is not selected, and then right-click inside the subreport control and then click Subreport in New Window.

Top of Page

No comments:

Post a Comment