Sei sulla pagina 1di 7

Access 2013: In Practice (Chapters 1-4)

Integrated Access Project 2


For this project, you enhance the functionality of a database that tracks daily price information for a
collection of stocks. The starting database file is provided for you. You use Design view to create a
second table, edit field properties, integrate data integrity rules, and import data from Excel. You also
create a relationship between the two tables and enforce referential integrity constraints. You create
several queries, and add calculated fields and aggregate functions. Finally, you create a report using the
Report Wizard, modify the layout and add conditional formatting in Layout view, and preview the
results.
[Student Learning Outcomes: 1.2, 2.1, 2.2, 2.6, 2.7, 3.2, 3.4, 3.7, 3.8, 4.4, 4.5, 4.6, 4.7, 4.8]
Files Needed: StockTracking.accdb and HistoricalPricesData.xlsx
Completed Project File Names: [your initials] Access Project 2.accdb

Skills Covered in this Project


Add database properties.
Open, save, and close, a table.
Create a table using Design view.
Add fields into a table.
Edit field properties in Design view.
Create a 1:M relationship between tables.
Enforce referential integrity.
View a table in Datasheet view and expand related records.
Import records from Excel.
Create a query in Design view.
Add calculated fields to a query.
Execute a query.
Sort query results.
Create a summary query.
Add aggregate functions to a query.
Create a report using the Report Wizard.
Edit a report in Layout view.
Edit grouping options in a report.
Add conditional formatting to a report.
Preview a report for printing.

1. Open the StockTracking.accdb database file from your student data files and save it as [your
initials] Access Project 2.
2. Review the existing table.
a. Open the Stocks table in Datasheet view. Verify that the table contains 25 records.
b. Switch to Design view.
c. Review the properties of the StockSymbol field since it is designated as the primary key. The
Data Type property contains Short Text and the Field Size property contains 7.
d. Close the table.
3. Create a new table using Table Design.

Access 2013: In Practice

Integrated Access Project 2 (Chapters 1-4)

Page 1 of 7

a. Add the following fields into the table and set field properties.
Field Name
Data Type
Description
FKStockSymbol

Short Text

Must match a StockSymbol in the


Stocks table

QuoteDate

Date/Time

Date of the price information

Open

Currency

Price at which the stock opened


that day

High

Currency

The highest price at which the


stock sold that day

Low

Currency

The lowest price at which the stock


sold that day

Close

Currency

The last price at which the stock


is sold that day

Volume

Number

Number of shares of stock sold on


that day

AdjClose

Currency

Adjusted closing price factoring in


appropriate split and dividend
multipliers

PriceChg

Currency

The difference between todays


closing price and the previous
closing price

PercentChg

Number

The percent value of the price


change

b. Create a concatenated primary key by selecting both the FKStockSymbol and the QuoteDate
fields together, and then clicking the Primary Key button.
c. Save the table as HistoricalPrices.
d. Change the Field Size of the FKStockSymbol field to 7.
e. Select a Short Date Format for the QuoteDate field.
f. Select a Standard Format and enter 0 for the Decimal Places for the Volume field.
g. For the PercentChg field, change the Field Size to Double, select a Percent Format, and select 2
for Decimal Places.
h. Make all fields Required, except for the PriceChg and PercentChg fields. On the first day of
trading, stocks will not have a value for those fields.
i. Save the table.
4. Create a one-to-many relationship between the Stocks table and the HistoricalPrices table.
a. Open the Relationships window and add the two tables. If the Show Table dialog box did not
automatically open, click the Show Table button to allow you to add the tables.
b. Drag the StockSymbol field from the Stocks table on top of the FKStockSymbol field in the
HistoricalPrices table. Release the pointer.
c. In the Edit Relationships dialog box, make the correct choices to Enforce Referential Integrity,
Cascade Update Related Fields and Cascade Delete Related Records.

Access 2013: In Practice

Integrated Access Project 2 (Chapters 1-4)

Page 2 of 7

5.

6.

7.

8.

9.

10.

d. Create the relationship.


e. Save the changes and close the Relationships window.
Import data from Excel into the HistoricalPrices table.
a. Launch the Get External Data Excel Spreadsheet dialog box.
b. Locate and select the HistoricalPricesData.xlsx Excel file.
c. Append the records to the HistoricalPrices table.
d. Click OK to launch the Import Spreadsheet Wizard.
e. Finish the Import Spreadsheet Wizard. Close the Wizard after the records have imported.
View the imported records.
a. Open the HistoricalPrices table in Datasheet view. Your table should contain 13,165 records.
b. Close the HistoricalPrices tables.
View the related data records in the Stocks table.
a. Open the Stocks table in Datasheet view.
b. Click the plus sign to the left of the StockSymbol field for AAPL. You should see that there are
549 rows of price data for Apple.
c. Close the Stocks table.
Create a new query to calculate the daily price range of stock prices.
a. Create a new query in Design view.
b. Add the HistoricalPrices table to the query and add the following fields into the query:
FKStockSymbol, QuoteDate, Open, and Close.
c. Right-click in the first open column in the query Design grid and open the Zoom window.
d. Type DailyRange:[Close]-[Open].
e. Sort the query by the DailyRange field in descending order.
f. Save the query as PriceDailyRange.
g. Run the query. The first record displayed should be for AAPL on 4/17/2012 with a DailyRange of
$30.76.
h. Close the query.
Create a new summary query in Design view. You want to find the largest percentage increase for
each stock.
a. Create a new query in Design view.
b. Add the both tables into the Query Design window.
c. Add the following fields into the query: StockSymbol, StockName, PercentChg.
d. Add the Total row to the query.
e. Group By the StockSymbol and StockName fields, and use the Max aggregate function on the
PercentChg field.
f. Sort the query by the PercentChg field in descending order.
g. Save the query as MaxPercentChgByStock.
h. Run the query. 25 records should display, with NFLX appearing at the top of the list with a
MaxofPercentChg of .42223.
i. Close the query.
Create a new summary query in Design view. You want to find the highest close price, smallest open
price, largest high price and largest volume traded for each stock.
a. Create a new query in Design view.
b. Add the both tables into the Query Design window.
c. Add the following fields into the query: StockSymbol, StockName, Close, Open, High and
Volume.
d. Add the Total row to the query.

Access 2013: In Practice

Integrated Access Project 2 (Chapters 1-4)

Page 3 of 7

e. Group By the StockSymbol and StockName fields, use the Max aggregate function on the Close,
High, and Volume fields, and the Min aggregate function on the Open field.
f. Sort the query by the Close field in descending order.
g. Save the query as MultipleStatisticsByStock.
h. Run the query. 25 records should display and match the results shown in Figure 1.
i. Close the query.

Figure 1 MultipleStatisticsByStock query results

11. Create a report using the Report Wizard.


a. Launch the Report Wizard.
b. Add the following fields into the report: StockSymbol and StockName from the Stocks table,
and Volume and PercentChg fields from the HistoricalPrices table.
c. On the second page of the Report Wizard, accept the suggested way to view the data by
StockSymbol and StockName.
d. On the third page of the Report Wizard, do not add any grouping levels.
e. On the fourth page of the Report Wizard, add Summary Options to display the Min and Max of
the Volume and PercentChg fields. Also select the Summary Only radio button for the Show
option.
f. Choose a Stepped layout and a Portrait orientation.
g. Change the suggested title to StockPriceSummary.
h. Click the Finish button. The preview of the report should look similar to Figure 2.

Access 2013: In Practice

Integrated Access Project 2 (Chapters 1-4)

Page 4 of 7

Figure 2 StockPriceSummary report created using the Report Wizard

12. Edit the report in Layout view so that it looks similar to Figure 3.
a. Switch to Layout view. If the Field List or Property Sheet open, close them.
b. Edit the Min label to read Minimum Value.
c. Edit the Max label to read Maximum Value.
d. Move the Min and Max labels to the right so that they are closer to the text boxes that contain
the values.
e. Move the PercentChg label and the Min and Max text boxes to the right.
f. Edit the PercentChg label to read % Chg of Daily Price.
g. Edit the label content, width, and location of the StockPriceSummary label in the header section
to match Figure 3.
h. Save the report.
13. Add conditional formatting to the report.
a. Add a rule so that any Max of PercentChg values that are greater than or equal to 20% display
in a bold, green font.
b. Add another rule so that any Min of PercentChg values that are less than or equal to -20%
display in a bold, red font.
c. Scroll through the records in the report to verify that you created and applied the rule correctly.
The first record that will show conditional formatting is Ford Motor Co.
d. Save the changes made to the report.
14. Edit the grouping and sorting in the report.
a. Change the group option to keep whole group together on one page.
b. Save the changes.
15. View the report in Print Preview.
a. Adjust the zoom to One Page. The report should be similar to that shown in Figure 3.

Access 2013: In Practice

Integrated Access Project 2 (Chapters 1-4)

Page 5 of 7

b. Close Print Preview.


c. Close the report.
16. Add the following database properties.
a. Title: Stock Database
b. Author: Student Name
c. Click OK to save the updated properties.
17. Close the database.

Figure 3 Completed StockPriceSummary report

Access 2013: In Practice

Integrated Access Project 2 (Chapters 1-4)

Page 6 of 7

Access 2013: In Practice

Integrated Access Project 2 (Chapters 1-4)

Page 7 of 7

Potrebbero piacerti anche