Presentation is loading. Please wait.

Presentation is loading. Please wait.

MBAC 611.  Click on the My Computer Icon  Open your private network directory  Create a new folder named lab7  Copy your lab6 Access file to the lab7.

Similar presentations


Presentation on theme: "MBAC 611.  Click on the My Computer Icon  Open your private network directory  Create a new folder named lab7  Copy your lab6 Access file to the lab7."— Presentation transcript:

1 MBAC 611

2  Click on the My Computer Icon  Open your private network directory  Create a new folder named lab7  Copy your lab6 Access file to the lab7 folder  Rename the copied lab6 Access file to lab7  Double Click on the lab7 Access file

3 If you see the following warning you can select This warning is prompted by the fact that programs can be created and run from within Access. So when you don’t know where a database originated from it is a good idea to let Access block these programs (what is called active content). You should now be in Access.

4  You should see the three Access table names on the left hand side of the screen.  These are the three tables you created during your last lab.

5  Double-click on the tab.  This allows data to be entered in the fields.

6 Cust_IDFirst_NameLast_NameStreet_AddressCityStateZip 1HowardSmith123 Main St.TrentonNJ11232 2DavidMay456 12 th AveAlbanyNY10457 3JaneLynn789 8 th St.IrvineCA76321 4SteveBerliner532 Maple Dr.AustinTX87431 We are going to enter the following data into the Customer table. Unfortunately, you cannot copy/paste whole records in Access. However, you copy/paste an individual field value – this may be useful for the Street_Address field. Enter the above data into the Customer table.

7 Once entered, we need to save the data. Right-click on the tab and then select.

8 We will now enter data into the Purchase Table. Double-click on the table tab. You should see the following empty table.

9 Cust_IDItem_IDPurchase_DateNum_Bought 2721 1/5/033 3456 3/9/051 1901 4/7/072 3435 8/4/031 Enter the following data into the Purchase Table. You will need to enter one row at a time as the key consists of the first three fields. Key fields cannot be blank. In Access the TAB or ENTER key can be used to move to the next field. Save and Close the table when done.

10 We will now enter data into the Item Table. Double-click on the table tab. You should see the following empty table.

11 Item_IDItem_NamePriceNum_Left 456Pen1.254 901Pencil1.008 721GI Joe15.991 435Barbie23.994 Enter the following data into the Item Table. Save and Close the table when done. Notice that Access automatically places the dollar sign next to entries in the Price field. This is due to the fact that we declared the Price field to be of type Currency.

12  Access allows us to query the data using a graphical method called Query By Example (QBE)  It also allows us to Query using SQL  QBE entries are converted to SQL and then executed to return the answer.

13  We will now create the query to list the first and last name of all customers who live in the state of “NJ”.  The Customer table has the information we need.  We need to query the state field.

14 Click on the tab. Click the icon. The following screen should appear:

15 From the Show Table dialog box select Customer and click Then select

16 We want to display the first and last name so lets add those fields to the query detail area near the bottom of the screen. Select and from the first and second column. We will also need the field so select that as well.

17 We are looking for individuals who live in New Jersey so lets place the value NJ into the Criteria section of the State field. Since NJ is a text value we need to place it in double quotes. If you forget to do so Access will add them for you when you move off the field.

18  To run the query click the icon located near the upper left hand corner of the Excel screen.  Our answer should appear in a New Table. The table is called Query 1.

19  Once we have our answer we can still modify our query and then re-run it.  Right-click on the tab and select  Lets modify the query so that it doesn’t display the state field – we know it will be NJ.  Click the check box in the State field.

20 Your query detail area should look like the following. Run the query by clicking on the icon. Notice that the State field is no longer displayed.

21 Right-click on the tab. Select the selection.

22 SELECT Customer.First_Name, Customer.Last_Name FROM Customer WHERE (((Customer.State)="NJ")); The extra parenthesis are not necessary. They have probably been placed to accommodate future criteria or queries involving field names that include spaces.

23 Remove the extra parenthesis in the SQL code and re-run the query to verify that it works. The code should appear as follows: SELECT Customer.First_Name, Customer.Last_Name FROM Customer WHERE Customer.State="NJ";

24 Right-click on the tab. Select the selection.

25 Change the Query 1 value in the Query Name Dialog Box to Question 1. Notice the Query appears under the Queries listing:

26  Create a query that does the following: List the Item_ID and Price of the item named “Barbie”. Hint: This requires the Item table. The answer should be: Save the query under the name Question 2.

27 Quit Microsoft Access. You won’t be able to submit the file if the database is open. A lock is placed on the file until you quit Access. Submit the Lab7 Access file to the Lab7 Moodle Assignment.


Download ppt "MBAC 611.  Click on the My Computer Icon  Open your private network directory  Create a new folder named lab7  Copy your lab6 Access file to the lab7."

Similar presentations


Ads by Google