27
Getting Started With MS Access Introduction to MS Access

Getting Started with MS Access and Pivot Tables

Embed Size (px)

DESCRIPTION

Learn the basics of Microsoft Access and how to create simple reports with Pivot Tables in MS Excel.

Citation preview

Page 1: Getting Started with MS Access and Pivot Tables

Getting Started With MS Access

Introduction to MS Access

Page 2: Getting Started with MS Access and Pivot Tables

Steps to create a query

• Understanding the requirements of the query• Gathering the tables required for the query• Creating Query• Set the query• Run the query

@_ParthAcharya

Page 3: Getting Started with MS Access and Pivot Tables

Understanding the query requirements• Each query requires certain fields

Let us understand the query requirements for the following query-

The query should display the following information: employee ID, employee first name, employee last name, employee address, employee salary, department name.

For the given query, the requirements is:Employee IDEmployee First NameEmployee last nameEmployee addressEmployee salaryDepartment name

@_ParthAcharya

Page 4: Getting Started with MS Access and Pivot Tables

Gathering the tablesrequired for the query

• Each field in the previous slide comes from some of the given tables

Tip: You can also double click the table names to see the fields and data.

@_ParthAcharya

Page 5: Getting Started with MS Access and Pivot Tables

Creating Querywith the gathered tables

1. Click on Query Design 2. Select the tables required for query and click on ‘Add’

@_ParthAcharya

Page 6: Getting Started with MS Access and Pivot Tables

1. Once you add the tables

Creating Query (Cont.)with the gathered tables

2. Create Relationship

Go to next slide for tips on creating relationship between tables

To connect two fields, click on one of the fields and drag your mouse to the other field

@_ParthAcharya

Page 7: Getting Started with MS Access and Pivot Tables

TipsCreate Relationship between tables

• Look out for a primary key (fields with a key on its left) in one of the tables to create a relationship with a field in the other table.

• Look out for data type match. The fields connecting two tables should have the same data type.• We will look at three fields, two from the Department table and one from the Employee table.

Here, the DepartmentID field from the table ‘Department’ has the same data type as the Department field in the ‘Employee’ table.

Note that, the Department field in the ‘Department’ table has different data type than the Department field in the ‘Employee’ table. And hence, you shall not connect them, even though the field names are same.

@_ParthAcharya

Page 8: Getting Started with MS Access and Pivot Tables

Set the query

• To set the query select the fields your query requires. In our case, we want Employee ID, Employee First Names, Employee last name, Department Name…. Etc.

Click on the Table dropdown and select the table you want a field from

Click on the Field dropdown and Select the field you want. Here, let’s select Employee ID

Select all the fields the query requires in the same way

@_ParthAcharya

Page 9: Getting Started with MS Access and Pivot Tables

Run the query

1. Hit the ‘Run’ button to run the query 2. Check the results

@_ParthAcharya

Page 10: Getting Started with MS Access and Pivot Tables

How to set criteria?

• There can be cases where you will need to set criteria• If you want the employees from just ‘Accounting’ department.

1. Go to the design view 2. In the criteria for Department field, type “Accounting” and run the query

Make sure you set the criteria for the appropriate field. Here, the criteria is “Accounting” department, which is related tothe Department field. And so, we will set the criteria for the Department field, and not for any other fields.

@_ParthAcharya

Page 11: Getting Started with MS Access and Pivot Tables

How to set criteria? (Cont.)

• There can be cases where you will need to set criteria• If you want the employees from just ‘Accounting’ department and with

Birthdate October 15th 1988.1. Go to the design view 2. In the criteria for Birthdate field, type #10/15/1988#

and run the query

@_ParthAcharya

Page 12: Getting Started with MS Access and Pivot Tables

How to set criteria? (Cont.)

• There can be cases where you will need to set criteria• If you want the employees from just ‘Accounting’ department and with

Birthday month May.1. Go to the design view 2. In the criteria for Birthdate field, type Month([Birthdate])=5

and run the query

The syntax is: Month([filed_name])=month_number Month([BirthDate])=5=>

@_ParthAcharya

Page 13: Getting Started with MS Access and Pivot Tables

How to sort?

• There can be cases where you will need to sort certain fields• If you want the employees from just ‘Accounting’ department with First Name

in alphabetical order1. Go to the design view 2. In the criteria for FirstName field, click on Sort

dropdown and select Ascending and run the query

@_ParthAcharya

Page 14: Getting Started with MS Access and Pivot Tables

Next PartGetting Started with Pivot Tables

Page 15: Getting Started with MS Access and Pivot Tables

Getting Started with Pivot Tables

Introduction to Pivot Tables in MS Excel

Page 16: Getting Started with MS Access and Pivot Tables

Before starting with Pivot Tables

• How to export an MS Access query to Excel

In the External Data tab of MS Access, click on ‘Excel’

@_ParthAcharya

Page 17: Getting Started with MS Access and Pivot Tables

Creating A Pivot Table

1. Select the top left cell of the exported excel sheet

2. Hit Ctrl+AThis will select your entire sheet.

3. In the Insert tab, select Pivot Table

@_ParthAcharya

Page 18: Getting Started with MS Access and Pivot Tables

Creating a Pivot Table (Cont.)

• A dialog box would pop up, make sure the ‘New Worksheet’ radio button is selected. Hit ‘OK’.

@_ParthAcharya

Page 19: Getting Started with MS Access and Pivot Tables

Steps to create Pivot Tables

1. Understand the requirements (Which fields are needed)2. Think of possible table layouts for the asked requirements

1. Which field should be set as ‘Row’?2. Which field should be se as ‘Column’?3. Which field should fit well as ‘Values’?

3. Look at the created pivot table and modify if needed

@_ParthAcharya

Page 20: Getting Started with MS Access and Pivot Tables

Understand the requirements

• Suppose we need to see Customers who bought Skateboards and T-Shirts. We also want to see how much did they spent on those two product.

Here, the requirements would include the following fields:• Customer Name• Product Description• Sales

@_ParthAcharya

Page 21: Getting Started with MS Access and Pivot Tables

Possible Layouts

Layout 1. Row: CustomersColumn: ProductsValues: Sales

Layout 2. Row: ProductsColumn: CustomersValues: Sales

Layout 3. Row: ProductsColumn: SalesValues: Customer

As you can see, Pivot Table can have many different layouts, we need to choose the one that fits our requirements the best.

@_ParthAcharya

Page 22: Getting Started with MS Access and Pivot Tables

Following Layout 1

1. Click on the required field

2. Drag it to the Row section

3. Similarly, drag the other two required fields to their respective sections (as decided for Layout 1)

@_ParthAcharya

Page 23: Getting Started with MS Access and Pivot Tables

The Created Pivot Table

Try to create Pivot Tables with other two Layout options and see if they fit well with our requirements

You will see that the Pivot Table created with Layout 1 fits our requirements the best

@_ParthAcharya

Page 24: Getting Started with MS Access and Pivot Tables

Filters

• If you remember, in our requirements, we want our Pivot Table with just two products: ‘Skateboard’ and ‘T-Shirt’.

To reduce our Pivot Table with Columns just for these two products, we will use filter.

1. To apply filter on Product Description Column, click on the Column Label dropdown button

2. Select the required products

@_ParthAcharya

Page 25: Getting Started with MS Access and Pivot Tables

Modified Pivot Table

On applying the filter, you will the Pivot Table that fulfils our requirements.

@_ParthAcharya

Page 26: Getting Started with MS Access and Pivot Tables

Some Excel FormulasCreate ‘Full Name’ column from ‘First Name’ and ‘Last Name’ columns

=CONCATNATE(first_name,” “,last_name)• Here, first_name is your data in the ‘First Name’ column; last_name is your data in the ‘Last Name’ column

• Make sure to put a space in “ “

Create ‘Month’ column from ‘Date’ column=TEXT(date,"mmmm")• Here, date is your data in the ‘Date’ column

@_ParthAcharya