Upload
others
View
1
Download
0
Embed Size (px)
Citation preview
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
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.
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.
And the repaired report in Print Preview:
Microsoft Access
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.
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
Use the same SSN that you used before when adding data to the tblPerson. Save and close the table.
Microsoft Access
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
A report that uses data from both tables:
Microsoft Access
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).
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
- Simple Query Wizard- Send over the AccountBalance field:
Microsoft Access
- 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.
The query is created. This query simply sums all of the AccountBalance fields. This type of basic query can be very useful.
Microsoft Access
Save and close the query. Make sure you use the correct prefix:
qryAccountBalance
Microsoft Access
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
Select Sum from the pull-down menu:
Microsoft Access
Other useful functions are available, also.
Link to Definitions Source
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
Open the exported table in Excel to see what it looks like:
Microsoft Access