HIGHER ADMINISTRATION CREATING REPORTS IN MS ACCESS South Lanarkshire Council Administration Higher Creating Reports in MS Access ------------------------------------------------------------------------------------------------------------------------- CONTENTS INTRODUCTION Creating a Report 3 3 GETTING STARTED 3 INSERTING A HEADER/FOOTER IN THE REPORT 9 ENHANCING THE REPORT 11 CHANGING FONT AND STYLE 12 INSERTING A LABEL 13 CHANGING THE SORT ORDER 13 PRACTICAL EXERCISE 1 15 PRACTICE MATERIAL 2 16 2 Administration Higher Creating Reports in MS Access ------------------------------------------------------------------------------------------------------------------------- INTRODUCTION To date we have displayed our data in a database using tables or queries. However to enhance the appearance of the table/query or show only part of the table/query we can use reports. Reports can be used to present the data from the table/query in a way that is much clearer and easier to understand. You can also use a report to change layouts to suit your requirements but we must remember that reports can only be used to display the data. Any changes that you want to make to the data must be made in the original table and the computer will automatically update the report accordingly. Creating a Report There are 3 ways to create a Report: Create your own from a blank design Use AutoReport Report Wizard. We will use the Report wizard as the computer will ask questions and then set up the Report for us, this will allow us to edit the layout to suit our preferences. GETTING STARTED 1 Open the file called HOLIDAY1. Click on the Reports tab. Click on create Report by using wizard. 3 Administration Higher Creating Reports in MS Access ------------------------------------------------------------------------------------------------------------------------- 3 The Report wizard window will appear on your screen. You can change the table you wish to extract the information from for your Report, however in this example we have only one table in our database, HOLIDAY. We now select the fields we want in our Report by clicking on the arrow icon. > In this example we want: CUSTOMER ID, CUSTOMER NAME, RESORT AND ACCOMMODATION fields. NOTE: If you wanted all the fields in your Report, by clicking on the double arrow they would all go over into the selected fields area. Similarly if you move a field over in error click on the return to the available field box. < arrow and it will Check the correct table is selected for your Report. Click on the arrow to move the fields across. Click Next once the 4 fields have been moved across. 4 The next window will ask about grouping levels. We don’t want any so click on Next. Click Next. 4 Administration Higher Creating Reports in MS Access ------------------------------------------------------------------------------------------------------------------------- 5 The next window asks about how you want to sort the report as shown below: Select Resort from the drop down list. Ensure Ascending is shown. Click Next. 5 Administration Higher Creating Reports in MS Access ------------------------------------------------------------------------------------------------------------------------- 6 The next window is giving you the chance to decide the layout for your Report. There are 3 options available and these are shown below COLUMNAR COLUMNAR Displays all the fields on the right hand side with the data next to it. TABULAR TABULAR Displays the fields along the top with the data underneath it. JUSTIFIED JUSTIFIED Specified layout. 6 Administration Higher Creating Reports in MS Access ------------------------------------------------------------------------------------------------------------------------- Follow the steps below to select the layout for your report: Select Tabular layout. Select Portrait Click Next. 7 Now you have to decide the style for the Report, again there are various choices. As you click through the different styles you will see a preview of each one. Select Corporate. Click Next. 7 Administration Higher Creating Reports in MS Access ------------------------------------------------------------------------------------------------------------------------- 8 You will now be asked to give your Report a title. Key in HOLIDAYS 2004 as your title. Click Finish to view your Report. 9 Your Report should be the same as the one shown below. By using the wizard you have created a very simple Report. We will go on and learn how to adjust the reports so that all the data is visible, insert headers and footers and change the font colour and style to make it look more attractive. As with forms, any changes to the layout or font colour etc has to be completed in Design View. 8 Administration Higher Creating Reports in MS Access ------------------------------------------------------------------------------------------------------------------------- INSERTING A HEADER/FOOTER IN THE REPORT You can either insert a page header/footer which means that it would print on every page of your Report or you can insert a Report header/footer which will only be printed on the first page of the Report and the Report footer is printed on the last page of the Report. From the example you have just created you will see the title of the report has been inserted as a Report Header and you will insert your name in a Report footer using the following instructions. 1 Open the Report Holidays 2004. 2 Click on the design icon at the left hand corner of the screen. 3 The screen will change to the design view of the Report as shown below: Click and drag the arrow downwards to create room to insert a footer. 4 In design view the toolbar should be shown on your screen automatically, if it is not go to the View menu and drag down to Toolbox. Click on the label icon and then click into the Report footer space once, now key in your footer. In this example key in your Own Name. 9 Administration Higher Creating Reports in MS Access ------------------------------------------------------------------------------------------------------------------------- 5 Your Report footer should now look like this: 6 Now right click to view the Report using the View icon at the left hand side of the screen. View icon. Select print preview from the options given and your report should be the same as shown below Report Header. Report Footer. 10 Administration Higher Creating Reports in MS Access ------------------------------------------------------------------------------------------------------------------------- ENHANCING THE REPORT If you look closely at the Holidays 2004 Report we have created, some of the information is truncated on your screen. We are now going to adjust the Report so that all data is visible. 1 In the page header section click on the heading Customer Name. Insert the pointer between the words Customer and Name and press the shift and return key. Your heading should look like below: Now alter the width of the heading box by clicking at the right hand side of the box until the pointer changes to a and drag to the appropriate size. 2 Click onto the heading Customer ID and move the pointer over the heading until the pointer changes to symbol. Now drag the heading to come before Customer Name. Adjust both headings so they are visible. 3 Adjust the headings in the detail section to correspond with the headings in the page header section of the report design. 3 Now adjust Name of Accommodation so the word Accommodation appears on the second line. Remember to sort the size of the heading box. 4 Now adjust the headings/ Remember to move the pointer over the heading until it changes to symbol which allows them to be moved. Ensure the headings are evenly spaced out in the design. 4 Lastly, in the report header section we need to pull down the blue line that separates the header section from the detail section. Move the pointer over the line until it changes to a symbol and then drag it down until it is below the headers as shown below: 5 Centre the Customer ID data by clicking on the centre align icon. 6 Adjust the remaining data of the detail section. Remember to check how the report looks in print preview as you make changes and that in the header section in design view all headers must be visible as this is what is printed on the report. However the headings in the detail section need not be visible as long as the data is visible in the Print Preview. 7 Save the report and print one copy of it. 11 Administration Higher Creating Reports in MS Access ------------------------------------------------------------------------------------------------------------------------- CHANGING FONT AND STYLE In the Report we can change the font style, size and colour as well as adding borders and fill colours to text boxes. You can either change each heading and data box individually or if you want them to change to the same font we can select all headings at once and then change the font, style etc. 1 Open the Holidays 2004 Report. 2 In design view, click on the Report header, hold your shift key and click on Report footer. 3 On the Formatting toolbar change the font to Algerian, size 26 and bold. Click on the font colour icon and select purple. On the Formatting toolbar click on the backfill/border colour icon and select pale blue. 4 Click anywhere in the Report to deselect the headings. Adjust the size of the report header box making it the same width as the report and centre the text. Move you name heading to the right hand side of the report and make the box the size required so that all data is visible. 5 Select the Page headings in the Report using the same method as above. 6 Select Comic Sans Font, size 12, bold and red. Adjust the boxes so that all data is visible. 7 Select the headings in the Detail Section of the report and select Times New Roman font, Size 10 and green font colour. Remember you have to check Print Preview that all data is visible. 8 Save the Report and close it down. You could also choose to insert a line/border colour on one of the textboxes by selecting the textbox and clicking on the icon and choosing the colour. The same applies to choosing a special effect for the textbox, select the textbox you want to apply the special effect to then click on the icon and choose the special effect i.e. raised. 12 Administration Higher Creating Reports in MS Access ------------------------------------------------------------------------------------------------------------------------- INSERTING A LABEL We can insert an additional label in our report in a similar way to inserting labels when using forms. 1 Open up the Holidays 2004 Report in design view. 2 Click on the label icon on the toolbar and then select Arial font, size 14, bold and yellow colour. Click on the left side of the report footer section and key in LAST UPDATED APRIL 2004. 3 The footer section should look like this: 4 Save the report and print one copy of it. CHANGING THE SORT ORDER Once you have created the Report you may decide to change the sort order or to insert a sort order. 1 Click on the reports tab and select HOLIDAYS 2004. 2 Click on the design icon. 3 Click on the Sort/Grouping icon on the toolbar. 4 The following menu will appear: In the first box select Customer ID from the drop down list select and ascending in sort order. Select Resort and ascending close the menu to accept the adjustments. 13 Administration Higher Creating Reports in MS Access ------------------------------------------------------------------------------------------------------------------------- 5 Open up the Report in print preview and check the sort order has changed. Your report should now be the same as below: 6 Save the report and print one copy. 14 Administration Higher Creating Reports in MS Access ------------------------------------------------------------------------------------------------------------------------- PRACTICAL EXERCISE 1 1 Open up the database Equipment. 2 Create a Report using the wizard which includes the following fields: Supplier Name Equipment Quantity Price per Item. 3 Insert Supplier Name as a grouping by highlighting the label and clicking on the > arrow. 4 Sort in descending order of Price per Item. 5 Use a stepped layout and portrait. 6 Name the Report Equipment Inventory. 7 Adjust the Report header to Comic Sans font, size 26, bold, colour blue with a red line border. Insert the header in the centre of the page. 8 Insert a Report footer - Own Name 2004. Use Arial font, size 20, italics, black colour with a yellow fill. Position at the left side of the page. 9 Change the page header layout to be the same as below: 10 Change the labels in the page header to Times New Roman font, size 12, bold and orange. 11 In the Detail section of the report to match with the page header. 12 Change the Supplier Name to Britannic Bold, size 11 and purple colour. 13 Save the report and print one copy of it. 15 Administration Higher Creating Reports in MS Access ------------------------------------------------------------------------------------------------------------------------- PRACTICE MATERIAL 2 1 Open the database Staff1. 2 Click on the Reports tab and create a Report using the Wizard, insert the following fields in the Report. First Name Last Name Department Salary Grade 3 Insert Department as a Grouping. 4 Sort on Salary Grade in ascending order. 5 Select the layout as Outline 1 and Landscape page orientation. 6 Select the style as Bold. 7 Change the Report Header to Staff Salary Information. 8 Insert a Report Footer with your Own Name. 9 Insert a Page Header of Home Electronics. 10 Change the Report Header, Report Footer, Page Header and Page Footer to Arial Font size 14 and blue. 11 Alter the headings so that all data is visible. 12 Extend the Report Header box to the whole width of the page and fill with pale pink colour and centre the text. 13 Change the other headings to Britannic Bold, size 10, bold and green. 14 Change the fields to Comic Sans, Red and size 10, make only the departments bold. 15 Save the report and print one copy and submit for marking. 16