Access Tutorial 3 - Instructions File
Access Tutorial 3 - Instructions File
This tutorial uses the same ‘Winter’ database from Tutorial 2. Please ensure your database matches the
one from Learn before beginning this Tutorial (WinterTut2Complete). This tutorial introduces Queries
and Reports.
Learning Objectives:
• Understand what a query is and how to create one
• Sort records in a query
• Use the criteria option to create a query that selects particular records
• Create a basic report based on a query
1
Microsoft Access 2019 Tutorial #3
We have successful used our query to join the three tables together. The second step is to identify the
specific details we wish to include in our query.
The first query we will create will detail the orders placed by each customer. It will include the following
fields:
• FirstName, LastName & CustID (From Customer table)
• OrderNo, Quantity & OrderDate (From Sales Order table)
• ProductNo, Description & Unit_Price (From Product table)
➢ Drag and drop each field from above and move from the Field List into the Design Grid.
Your Design Grid should match as shown below.
Field List
Design Grid
2
Microsoft Access 2019 Tutorial #3
1.3 - Sorting
You can quickly sort records in the Datasheet view of a Table, Query or Form.
➢ Select the drop-down arrow next to OrderTotal. Choose Sort Smallest to Largest. You will
see the order of the records change.
➢ Change the sort order to CustID smallest to largest.
While that is a simple method, you may want to set the sort order for a query by default, rather than
manually changing from the datasheet view.
➢ Navigate to the Customer Orders query in the All Access Objects pane, right click and
select Design.
➢ In the Design view, select the field that you wish to sort on and click in the Sort row. A down
arrow will appear. Click on the down arrow and select Ascending.
➢ Navigate to the Datasheet view of your Customer Orders query to view the sorted orders.
Go back to the Design view and sort the order to Descending.
Remember to Save your query.
3
Microsoft Access 2019 Tutorial #3
➢ For each of the fields that are not required, remove the tick in the Show box. This is useful
when you want to sort or select on a criterion, but not show that data in your result.
Please check the images below if you have any issues.
Design View
Datasheet View
2.2 - Joining Two or More Fields
So far, we have been working with the customers’ name as two separate fields. Sometimes, it is more
useful to show this as one field (Customer Name), that is, we may want to join (concatenate) two or
more fields together.
In this task we will modify our Customer Orders query to include a new field called CustomerName
made up of FirstName and LastName.
➢ Open the Customer Orders query in Design view. As we did early, we will follow the
same process as we did when creating a calculated field.
➢ Click on the last column of the Field row to add a new field. This will be called
CustomerName. Joining two fields together requires a plus (+) sign.
➢ Enter CustomerName: [FirstName] + " " + [LastName]
The " " signifies an empty space. You could enter anything in here to show between first name and last
name such as a comma (,).
➢ Open the Customer Orders query in Datasheet view to see the changes you have made.
You will see FirstName, LastName and CustomerName showing.
➢ Modify the query to show only CustomerName (not FirstName or LastName).
➢ Be sure to save your query.
Extra Resources
➢ More details on managing data with queries can be found here.
4
Microsoft Access 2019 Tutorial #3
➢ From the list of available fields, highlight each field that is required and move them to the
Select Fields list by clicking the > button. Ensure to select the fields listed below and click
Next.
• CustomerName
• OrderDate
• Quantity
• Description
• Unit_Price
• OrderTotal
You will now be asked if you wish to add a Grouping level to group the records. This allows you to
break the report into parts based on a particular field. We will break our report into each Customer.
➢ Select the CustomerName field and click the > button. Click Next.
The wizard will now prompt you to identify a Sort
order for the report. Sorting allows you to specify the
order in which report contents are to be listed.
Sorting will order the records within the group based
on the field you select.
➢ Select OrderDate from the drop-down
menu and click next. Ensure Ascending
is selected. Click Next.
5
Microsoft Access 2019 Tutorial #3
You will now be asked to choose your layout and orientation for your report. The layout option allows
you to specify how the data will be arranged on the page.
➢ Select Stepped layout and Portrait orientation to format our report. Be sure to check
Adjust the field width so all fields fit on a page. Click Next.
The final step is to name your report. To do this, you need to enter a Title.
➢ Choose an appropriate name such as Customer Orders. Ensure the Preview the report
option is checked and click Finish.
You may need to modify the layout of the report to show all information properly (Dates may show as
#######). We will do this next week.
Check over the page to ensure your report matches the one shown. Do not worry if the layout is incorrect,
just ensure that the correct information is being shown.
Extra Practise
1. The Accounts Payable Accountant has asked for a list of creditors. Run a query that shows
each customer’s name (in one field), their credit limit, balance and credit rating. The Accounts
Payable Accountant has asked to see all customers with a poor or terrible credit rating only.
2. The Store Manager wants to see the total sales made since Winter opened. Run a query that
shoes the product description, unit price, total quantity sold and the total sales made for each
product. The Store Manager also wants to know when the last sales date was with the products
ordered from highest to lowest in terms of the total sales made.
Extra Resources
➢ More details on creating reports can be found here.