IS 650-606, Spring 2005, Technology Focus Lab 3

Total Page:16

File Type:pdf, Size:1020Kb

IS 650-606, Spring 2005, Technology Focus Lab 3

IS 650-606, Spring 2005, Technology Focus Lab 3: Writing Queries, Creating Reports and User Forms.

Part I: GETTING STARTED

1. Download the database named Lab3.mdb form the class web site and save it on your local desktop.

2. Open the database by either double clicking on the lab3.mdb or by starting the “Microsoft Office Access 2003”.

3. After the Access database menu appears, click on “Tools”, and select “Relationships”.

a. You should see four tables capturing the information about products and product categories, customers, time periods in which sale events have occurred. Finally, the fifth table named: “Transaction Events” has a central role in the whole database, which is to capture each individual sale event. It has three foreign keys: Product ID , Customer ID and Period ID which jointly form a primary key as well. Additional attributes found in this table are the price of a product sold in this transaction as well as the quantity sold.

b. If the tables and relationships do not show as in the picture above, raise your hand.

4. Minimize the “Relationships”. window and double click on the table “Transaction Events” Look at the content of this table and try to answer the following question: Q1. Why is the product price an attribute in the table “Transaction Events”? In other words, why not have the product price attribute in the “Product” table and avoid the repetition of the same

Part II: CREATING A QUERY

1. Click on the “Queries” object and choose the option “Create query by using wizard”, as shown in this screenshot:

2. The first query that we will create will provide an answer to this question: “How many items of each product category were sold in the each quarter?” a. Use the pull down menu as shown in the following screen shot to choose the tables and the attributes that are relevant to this query:

b. In this case we are interested in the following attributes: i. Category Description, which is in the Category table. ii. Period Name, which is in the Time Period table. iii. Quantity Sold, which is in the “Transaction Events” table.

These attributes should be moved from the “Available Fields” area to the “Selected Fields” area by using the button, as shown in the screen shot below:

c. When you are finished adding the three attributes needed for this query to the “Selected Fields” area, click on the “Next >” button. i. You will be asked whether you want a detail or a summary query. Choose summary option. ii. Then click on summary options button and choose sum checkbox. Hit ‘Ok” button. iii. click on the “Next >” button, and give your query a name: “Product Category Sales by Quarters”. iv. Click on “Finish” button to view the results of the query.

Repeat the whole process by creating the queries that will answer the following questions

Query 2: “What is the total number of products sold for each customer location (region)” Name this query: “Products Sold by Customer Location”

Query 3: What was the average price in an individual sale in each quarter and “ Name this query: “Average Sale Price by Quarters”

Always start by listing the attributes that will be needed in a query. Raise your hand if you need help.

Modify the Query 2: to show revenue by customer location as well. In order to this, you will need my or my assistant’s help. This process involves a creation of a so-called derived attribute. Part III: CREATING A REPORT

1. Create a report for the Products Sold by Customer Location by clicking on the “Reports” and choosing the “Create Report by using wizard” option.

2. Choose the query from the pull down menu as shown in the screenshot below:

3. Choose all the available fields by clicking on the button.

4. Skip the “grouping Levels” question by clicking on the “Next >” button.

5. In the next window, choose to sort records in ascending order by Customer Location.

6. Use the last two windows to choose the layout and style of your choice. (Simple tabular layout is often the easiest to view and interpret)

7. Name this report in the same fashion as the query.

Create reports for other two queries.

PART IV: Creating a FORM.

Forms are Microsoft Access objects that can be used for creation of a very basic front end user interface for data entry. That way, end users do not have to interact with the database directly and be aware of the specific database management rules (such as referential integrity) that need to be enforced when one interacts directly with the database tables. In real life, front end user interface would be designed in a client side programming language such as Visual Basic and would have many different components such as text boxes, buttons, pull down menus, check boxes etc. In this lab we will use the Access forms tool, which while very rudimentary can still be used as a very rough approximation of the front end user interface tool.

We will create a very basic form that will enable user to add a new product to the product table or modify the existing product information.

1. Click on “Create Form by using wizard” option.

2. Using the similar screen to the ones for creating new queries and new reports, choose all the attributes that describe an individual product and include them in the form.

Q2. What Attributes, from which tables, describe an individual product (use the relational schema on the first page of your handout as a guide):

3. Once you chose all the necessary attributes go to the next screen and choos to view your data by products. 4. In the layout screen, choose justified layout. 5. Choose any style you want in the next screen. 6. Name your form “Product Entry Form” and click finish. 7. The form will open. Use the buttons with arrows on the bottom right hand side to move through all the existing product records. 8. Add a new product using this form. a. Add a product that belongs to an exiting category

Q3: Did you have to type the product description in the form: Why? /Why Not?

b. Add one more product that belongs to a new category that does not yet exists.

Q4: Did you have to type the product description in the form: Why? /Why Not?

9. Verify that both product data have actually been added to the proper tables by opening and viewing the content of Product and Category tables.

Recommended publications