Creating Reports in Microsoft Access 2007 Using Queries and Report Design Mode
Creating Reports in Microsoft Access 2007 Using Queries and Report Design Mode
SandraDyke,2010
Access2007Tutorial
This tutorial assumes the Microsoft Access 2007 Tutorial has been completed to create the Basic Sales System Database Objective: to create a report which could be used as a statement and looks like the following:
SandraDyke,2010
Page1
Access2007Tutorial
Create the following queries Results are shown for each query but your results may be different depending on the data contained in your tables. qEmployeeDetails
Result:
SandraDyke,2010
Page2
Access2007Tutorial
qCustomerAddressDetails
Result:
SandraDyke,2010
Page3
Access2007Tutorial
qCustomerSaleInvoice
Result:
(NB: new sales cant be added to this query they have to be added to the sales table and then the query refreshed to show a new invoice)
SandraDyke,2010
Page4
Access2007Tutorial
qCompleteSaleDetail To create the following query, use the create query deign option but this time select from the Queries tab in the Show Tables dialogue:
Select qCustomerAddressDetails, qCustomerSaleInvoice and qEmployeeDetails queries created above. Run your query the resulting query matches everything from one table to the others. Relationships between the queries need to be established. Drag the CustomerID from qCustomerAddressDetails to qCustomerSaleInvoice and the EmployeeID from qCustomerSaleInvoice to qEmployeeDetails to create the relationships below:
SandraDyke,2010
Page5
Access2007Tutorial
Depending on the data contained in the various tables, the following results may be produced Result:
SandraDyke,2010
Page6
Access2007Tutorial
Producing a Report Using the qCompleteSaleDetail Query This time, the report is going to be produced using the Create Report Design option
With the Property Sheet open, click on the down arrow for the record source and select qCompleteSaleDetail. You may need to resize the Property Sheet Window first.
Select the Add Existing Fields option and all of the fields contained in the query will be available. If any are missing, go back to the query, make sure the fields are contained in the query and the show box is ticked. If any arent showing, adjust and the save your query. The new fields should then be available.
SandraDyke,2010
Page7
Access2007Tutorial
Drag all of the fields required for the report into the Detail section of the blank report:
Dont worry about tiding anything up yet. View the report fairly ugly really isnt it? Also, the customer details are repeated for each purchase. Lets sort based on CustomerID so that each customers details are only shown once. Make sure the Groups & Sort option on the Design tab is selected
SandraDyke,2010
Page8
Access2007Tutorial
Click on the Add a group button in the Group, Sort, and Total section at the bottom of the page.
Select CustomerID
This has created a Customer Header above the detail section of the report
And added a group tab in the Group, Sort, and Total section
Select the customer details in the Details section and cut and paste into the CustomerID Header
SandraDyke,2010
Page9
Access2007Tutorial
Now when the report is viewed, the customer details only appear once followed by all the sale details related to the customer. However, the sale detail headings are still being repeated so these need to be moved into the CustomerID Header section as well. To do this, the labels for each field needs to be separated from their field details. Select the sale details and click on the Stacked option in the Arrange tab
While these items are still selected, click on the Remove option
SandraDyke,2010
Page10
Access2007Tutorial
Click on the top of the Detail bar until the pointer changes into a double headed arrow with a line through it and drag the bar down to make some space.
Click on the label portion of the field (should be the left half) and cut and paste into the CustomerID Header section. You may need to separate the label and text details apart first so that just the label is selected.
Repeat the stack and remove actions above for the address details and then delete the customer detail labels so only the customer details remain.
SandraDyke,2010
Page11
Access2007Tutorial
The CustomerID Header, Detail and Page Footer bars can be moved in the same way as the Detail bar was moved above. View the report:
SandraDyke,2010
Page12
Access2007Tutorial
Now to separate each customer on to their own page: Click on the CustomerID Header to select it and then change the Force New Page option to Before Section.
SandraDyke,2010
Page13
Access2007Tutorial
Move through the pages by using the arrows at the bottom of the page. NB if the report is viewed in the Report option, there wont be separate pages.
Click on More in the Group on CustomerID section and show the footer
The following: Make sure the TotalSalePrice is shown before selecting the ShowGrandTotal and Show in group footer options.
SandraDyke,2010
Page14
Access2007Tutorial
Make any final adjustments (eg bold headings, bring in a company logo this was done by using WordArt in Word and copying it to this report)
The date can be added to the page footer, a report title can be added to the report header and the date and time of printing the report can be added to the report footer but I leave this to you to try yourselves.
SandraDyke,2010
Page15
Access2007Tutorial