access integrated project 2

Upload: mohini-sharma

Post on 02-Jun-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/10/2019 Access Integrated Project 2

    1/7

    Access 2013: In Practice Integrated Access Project 2 (Chapters 1-4) Page 1 of 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 Designview to create asecond 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 Layoutview, 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.accdband 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 Designview.

    Add fields into a table.

    Edit field properties in Designview.

    Create a 1:M relationship between tables.

    Enforce referential integrity.

    View a table in Datasheetview and expand related records.

    Import records from Excel.

    Create a query in Designview.

    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 Layoutview.

    Edit grouping options in a report.

    Add conditional formatting to a report.

    Preview a report for printing.

    1. Open the StockTracking.accdbdatabase file from your student data files andsave it as[your

    initials] Access Project 2.2. Review the existing table.

    a. Open the Stockstable in Datasheetview. Verify that the table contains 25 records.

    b.

    Switch to Designview.

    c.

    Review the properties of the StockSymbolfield since it is designated as the primary key. The

    Data Typeproperty contains Short Textand the Field Sizeproperty contains 7.

    d. Close the table.

    3. Create a new table using TableDesign.

  • 8/10/2019 Access Integrated Project 2

    2/7

    Access 2013: In Practice Integrated Access Project 2 (Chapters 1-4) Page 2 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 theStocks table

    QuoteDateDate/Time

    Date of the price information

    Open Currency Price at which the stock openedthat day

    High Currency The highest price at which thestock sold that day

    Low Currency The lowest price at which the stocksold that day

    Close Currency The last price at which the stockis sold that day

    Volume Number Number of shares of stock sold onthat day

    AdjClose Currency Adjusted closing price factoring inappropriate split and dividend

    multipliers

    PriceChg Currency The difference between todaysclosing price and the previous

    closing price

    PercentChg Number The percent value of the pricechange

    b.

    Create a concatenated primary keyby selecting both the FKStockSymboland the QuoteDate

    fields together, and then clicking the Primary Keybutton.

    c. Save the table as HistoricalPrices.

    d. Change the Field Sizeof the FKStockSymbolfield to 7.

    e. Select a Short DateFormat for theQuoteDate field.

    f. Select a StandardFormatand enter 0for the Decimal Placesfor the Volumefield.

    g. For the PercentChgfield, change the Field Sizeto Double, select a PercentFormat, and select2

    forDecimal Places.

    h. Make all fields Required, except for the PriceChgand PercentChgfields. 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 Stockstable and the HistoricalPricestable.

    a. Open the Relationshipswindow and add the two tables. If the Show Tabledialog box did not

    automatically open, click the Show Tablebutton to allow you to add the tables.

    b.

    Drag the StockSymbolfield from the Stockstable on top of the FKStockSymbolfield in the

    HistoricalPricestable. Release the pointer.

    c.

    In the Edit Relationshipsdialog box, make the correct choices to Enforce Referential Integrity,

    Cascade Update Related Fieldsand Cascade Delete Related Records.

  • 8/10/2019 Access Integrated Project 2

    3/7

    Access 2013: In Practice Integrated Access Project 2 (Chapters 1-4) Page 3 of 7

    d. Create the relationship.

    e. Save the changes and close the Relationshipswindow.

    5. Import data from Excel into the HistoricalPricestable.

    a. Launch the Get External Data Excel Spreadsheetdialog box.

    b. Locate and select the HistoricalPricesData.xlsxExcel file.

    c. Append the records to the HistoricalPricestable.

    d.

    Click OKto launch the Import Spreadsheet Wizard.

    e. Finish the Import Spreadsheet Wizard. Close the Wizardafter the records have imported.

    6. View the imported records.

    a. Open the HistoricalPrices table in Datasheetview. Your table should contain 13,165 records.

    b. Close the HistoricalPrices tables.

    7.

    View the related data records in the Stockstable.

    a.

    Open the Stockstable in Datasheetview.

    b. Click theplus signto the left of the StockSymbolfield forAAPL. You should see that there are

    549 rows of price data for Apple.

    c. Close the Stockstable.

    8. Create a new query to calculate the daily price range of stock prices.

    a.

    Create a new query in Designview.b. Add the HistoricalPricestable 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 gridand open theZoomwindow.

    d. Type DailyRange:[Close]-[Open].

    e. Sort the query by the DailyRangefield 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 DailyRangeof

    $30.76.

    h. Close the query.

    9. Create a new summary query in Designview. You want to find the largest percentage increase for

    each stock.a. Create a new query in Designview.

    b. Add the both tables into the Query Designwindow.

    c. Add the following fields into the query: StockSymbol, StockName, PercentChg.

    d. Add the Totalrow to the query.

    e. Group Bythe StockSymboland StockNamefields, and use the Maxaggregate function on the

    PercentChgfield.

    f.

    Sort the query by the PercentChgfield in descending order.

    g.

    Save the query asMaxPercentChgByStock.

    h. Run the query. 25 records should display, with NFLX appearing at the top of the list with a

    MaxofPercentChgof .42223.

    i.

    Close the query.

    10.

    Create a new summary query in Designview. 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 Designview.

    b. Add the both tables into the Query Designwindow.

    c. Add the following fields into the query: StockSymbol, StockName, Close,Open, High and

    Volume.

    d. Add the Totalrow to the query.

  • 8/10/2019 Access Integrated Project 2

    4/7

    Access 2013: In Practice Integrated Access Project 2 (Chapters 1-4) Page 4 of 7

    e. Group Bythe StockSymboland StockNamefields, use the Maxaggregate function on the Close,

    High, andVolumefields, and the Minaggregate function on the Openfield.

    f. Sort the query by the Closefield in descending order.

    g. Save the query asMultipleStatisticsByStock.

    h. Run the query. 25 records should display and match the results shown in Figure 1.

    i. Close the query.

    11.

    Create a report using the Report Wizard.a.

    Launch the Report Wizard.

    b.

    Add the following fields into the report: StockSymboland StockNamefrom the Stockstable,

    and Volumeand PercentChgfields from the HistoricalPricestable.

    c. On the second page of the Report Wizard, accept the suggested way to view the data by

    StockSymboland 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 Optionsto display the Minand Maxof

    the Volumeand PercentChgfields. Also select the Summary Onlyradio button for the Show

    option.

    f. Choose a Steppedlayout and a Portraitorientation.

    g. Change the suggested title to StockPriceSummary.

    h.

    Click the Finishbutton. The preview of the report should look similar to Figure 2.

    Figure 1 MultipleStatisticsByStockquery results

  • 8/10/2019 Access Integrated Project 2

    5/7

    Access 2013: In Practice Integrated Access Project 2 (Chapters 1-4) Page 5 of 7

    12.Edit the report in Layoutview so that it looks similar to Figure 3.

    a.

    Switch to Layoutview. If the Field Listor Property Sheetopen, close them.

    b. Edit the Minlabel to readMinimum Value.

    c. Edit the Maxlabel to readMaximum Value.

    d.

    Move the Minand Maxlabels to the right so that they are closer to the text boxes that containthe values.

    e. Move the PercentChglabel and the Minand Maxtext boxes to the right.

    f. Edit the PercentChglabel to read % Chg of Daily Price.

    g. Edit the label content, width, and location of the StockPriceSummarylabel 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 ofPercentChgvalues that are greater than or equal to20%display

    in a bold, greenfont.

    b. Add another rule so that any Min ofPercentChgvalues that are less than or equal to-20%

    display in a bold, redfont.

    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.

    Figure 2 StockPriceSummaryreport created using the Report Wizard

  • 8/10/2019 Access Integrated Project 2

    6/7

    Access 2013: In Practice Integrated Access Project 2 (Chapters 1-4) Page 6 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 OKto save the updated properties.

    17.

    Close the database.

    Figure 3Completed StockPriceSummaryreport

  • 8/10/2019 Access Integrated Project 2

    7/7

    Access 2013: In Practice Integrated Access Project 2 (Chapters 1-4) Page 7 of 7