19
Note: This slideshow is a continuation of the previous slideshow. Let’s create a report: Remember, a report object summarizes the fields and records from a table or query in an easy-to-read format suitable for printing or distribution. Microsoft Access

Microsoft Access - Coe College

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Microsoft Access - Coe College

Note: This slideshow is a continuation of the previous slideshow.

Let’s create a report:• Remember, a report object summarizes the fields and records

from a table or query in an easy-to-read format suitable for printing or distribution.

Microsoft Access

Page 2: Microsoft Access - Coe College

We would like an easy-to-read document that only displays the first and last name of the people in the tblPerson, and their credit card information. Use the Report Wizard. (Make sure all forms and tables are closed first.)

Microsoft Access

Add spaces in the text and move things around, and work with text alignment so the text can be read. This can be done in

report design view.

Page 3: Microsoft Access - Coe College

Be careful which boxes you fix… in this report the light grey text with dots behind it indicates the headings. The text in the other boxes should not be touched – it is programmed according to the table field name.

Microsoft Access

Add spaces in the text and move things around, and work with text alignment so the text can be read. This can be done in

report design view.

Page 4: Microsoft Access - Coe College

And the repaired report in Print Preview:

Microsoft Access

Page 5: Microsoft Access - Coe College

Let’s build another table, and then add connections between it and the other table:• The table Balance (tblBalance) will store the person’s Account

Balance information.• Reminder: When you add connections, you are making use of the

“relational” aspect of the Access DBMS (Database Management System).

Microsoft Access

Use an input mask for SSN.

Page 6: Microsoft Access - Coe College

Add data to table AccountBalance in datasheet view to save time. Normally a form is created and then used to add data to a table, but sometimes using table datasheet view works just fine.

Microsoft Access

Page 7: Microsoft Access - Coe College

Use the same SSN that you used before when adding data to the tblPerson. Save and close the table.

Microsoft Access

Page 8: Microsoft Access - Coe College

Let’s add a relationship between the PersonID field of the two tables:

And then we’ll create a report that uses data from both tables.

Microsoft Access

Page 9: Microsoft Access - Coe College

A report that uses data from both tables:

Microsoft Access

Page 10: Microsoft Access - Coe College

Queries, from the Microsoft website:

“When you want to review, add, change, or delete data from your database consider using a query. Using a query, you can answer very specific questions about your data that would be difficult to answer by looking at table data directly. You can use queries to filter your data, to perform calculations with your data, and to summarize your data. You can also use queries to automate many data management tasks and to review changes in your data before you commit to those changes.”

Microsoft Access

We’ll use a query to answer a question about the people in our database: what is the total amount of all of the account balances? The query will perform a

calculation with the data (a basic sum function).

Page 11: Microsoft Access - Coe College

One of the most basic queries is a summary query. A summary query can sum fields in a table. So, for example, we can easily find out the total of all accounts in the tblAccountBalance. If there were hundreds, or even thousands, of entries in the tblAccountBalancethis would be a big time saver.

Start by making sure all objects are closed, then go to the Create tab, Query Wizard command:

Microsoft Access

Page 12: Microsoft Access - Coe College

- Simple Query Wizard- Send over the AccountBalance field:

Microsoft Access

Page 13: Microsoft Access - Coe College

- Select Summary:

- Then Summary Options:

- Then Finish.

Microsoft Access

Check the boxes next to the functions you are interested in.

Sum is the only function for now.

Page 14: Microsoft Access - Coe College

The query is created. This query simply sums all of the AccountBalance fields. This type of basic query can be very useful.

Microsoft Access

Page 15: Microsoft Access - Coe College

Save and close the query. Make sure you use the correct prefix:

qryAccountBalance

Microsoft Access

Page 16: Microsoft Access - Coe College

Another way to find out the sum of all of the account balances in our tblAccountBalance is to add a total row to the table itself.

- Open tblAccountBalance- In the Home tab, Records group, press the Totals command:

Microsoft Access

Page 17: Microsoft Access - Coe College

Select Sum from the pull-down menu:

Microsoft Access

Other useful functions are available, also.

Link to Definitions Source

Page 18: Microsoft Access - Coe College

What if you want to use data from a table in Excel? You can easily export table contents to an Excel workbook.

- Open tblPerson- Select the External Data tab, Export group, Excel command:

Microsoft Access

Page 19: Microsoft Access - Coe College

Open the exported table in Excel to see what it looks like:

Microsoft Access