MS Access - Reports Basics


Advertisements

In this chapter, we will be covering the basics of reports and how to create reports. Reports offer a way to view, format, and summarize the information in your Microsoft Access database. For example, you can create a simple report of phone numbers for all your contacts.

  • A report consists of information that is pulled from tables or queries, as well as information that is stored with the report design, such as labels, headings, and graphics.

  • The tables or queries that provide the underlying data are also known as the report's record source.

  • If the fields that you want to include all exist in a single table, use that table as the record source.

  • If the fields are contained in more than one table, you need to use one or more queries as the record source.

Example

We will now take a simple example to understand the process of creating a very simple report. For this, we need to go to the Create tab.

Report

Before clicking on the Report button to create a basic report, make sure the proper query is selected. In this case, qryCurrentProjects is selected in your navigation pane. Now click on the Report button, which will generate a report based on that query.

Project Selected

You will see that the report is open in Layout view. This provides a quick way to adjust the size or width of any of your fields that you see on the report. Let us now adjust the column widths to make everything fit in a better way.

Adjust Columns

Scroll down and adjust the page control at the bottom.

Adjust Page Control

This was a very quick way to create a very simple report. You could also make minor changes and adjustments from the report design view.

Quick Way
  • Just like forms, a report is made up of a variety of different sections.
  • You have the detail section, which is where all of your data lives for the most part.
  • You also will see a page header and a page footer section; these appear at the top and at the bottom of every single page in your report.

Let us now change the Title of the report and give it another name.

Change Title

Click on the save icon to save your report.

Report Name

You will get the above dialog box.

Enter a name for your report and click Ok. If you want to view what this report will actually look like, in Print Preview, you can go back to the View button and click on Print Preview to see what this report would look like when printed either on paper or as a PDF.

Actual Look

Using the tools on the lower right-hand corner, you can zoom in or zoom out. You also have some buttons on the Print Preview tab that appear automatically when you switch to Print Preview. In the zoom section, you've got a view for one page, two pages; or if you have a longer report, you can view four pages at once, eight pages or twelve pages. You can also adjust simple things such as the size of the paper that you are using to print, the margins for your report, the orientation, the number of columns, page set up, etc. And that is how you can create a very quick simple report using the Report button on the Create tab.

Create a Report Using Report Design

Report Design is another method for creating a quick report in Access. For this, we need to use the Report Design View button, which is like the Form Design button. This will create a blank report and open it directly to the Design View, allowing you to change the control source and add fields directly to the Design View of the report.

Let us now go to the Create tab and click on the Report Design button.

Report Design

It will open a blank report or an unbound report, meaning this report is connected to no other object in our database.

Unbound Report

On the Design tab in the Tools group, select the Property Sheet. This will open up the Property pane.

Tools Group

On the Data tab, assign a record source to this report, to connect it to a database object as in the following screenshot.

Data Tab

Select qryLateProjects from the drop-down and now, the next step is to go through and add some fields to this report by clicking on Add Existing Fields list button on the Design tab.

Late Projects

Select the fields as in the above screenshot.

Select Fields

Drag the fields to you report as in the above screenshot. Go the Arrange tab, and in the Table group, you have a couple of options to choose from.

Choose Form

There is a stacked layout and a tabular layout, which is a layout that is very similar to a spreadsheet. Let us select the tabular layout.

Tabular Layout

You can see that it moves all of the labels up to the page header area. These labels will appear only once at the top of every page and the data query will repeat for every record in the Details section. Now, you can go through and make some adjustments to make your ProjectName field wider.

Field Wider

As you can see in the above screenshot, there is a lot of space between Detail section and Page Footer.

Let us drag the Page Footer up to reduce the space as in the following screenshot. We will now go to the Design tab and click on the View button and choose Report View.

Page Footer

Report View

You can now see that some project names are not complete; you can adjust this with either the design view, or you can use the layout view to do that.

Simple Report

That is how we create a simple report just from the Design View.

Advertisements