0% found this document useful (0 votes)
60 views25 pages

Office2016VideoProject39 BuildAccessDatabase

This document provides steps to build an Access database for a small business called Wooden Crafts. The steps include: 1. Creating a new Access database and importing an Excel table with supplier data. 2. Adding data types and field properties to tables in the new database. 3. Creating a relationship between the imported supplier table and a new product table using a lookup wizard. The document then lists more specific steps to implement each of the high-level steps, including screenshots to illustrate the process.

Uploaded by

mart0830
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views25 pages

Office2016VideoProject39 BuildAccessDatabase

This document provides steps to build an Access database for a small business called Wooden Crafts. The steps include: 1. Creating a new Access database and importing an Excel table with supplier data. 2. Adding data types and field properties to tables in the new database. 3. Creating a relationship between the imported supplier table and a new product table using a lookup wizard. The document then lists more specific steps to implement each of the high-level steps, including screenshots to illustrate the process.

Uploaded by

mart0830
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

Highline College - Busn 216: Computer Applications for Business (Fun and Power with Computers)

Office 2016 Video #39:


Access 2016: Create Database, Import Excel, Create Tables & Forms, Build Relationships

This handout lists the steps for building an Access Database for a small kiosk business in a mall. The name of the
business is Wooden Crafts. Wooden Crafts sell wooden toys. Wooden Crafts has asked you to design a database that
stores product data and supplier data that will produce reports such as product list, supplier list and inventory value.

The overriding steps to build Wooden Crafts database are here:


Video #39
1. Create New Database.
2. Import SupplierData Table into Database from an Excel workbook.
3. Add Data Types and Field Properties to each Field in the SupplierData Table
4. In Access create a Product Table and add Data Types and Field Properties
5. Use Data Type Lookup Wizard to connect the Products table to the SupplierData table with a One-To-Many
Relationship between the two Supplier Code Fields. We will also use Lookup Wizard to create a Whole Sale
Retail Field.
6. Use Relationship Window to add "Referential Integrity" to One-To-Many Relationship between the two
Suppliers Code fields
7. Create a Form for the Products Table
8. Add data to Products table using the Products Form
9. Create Queries with various Logical Constructions and Formulas (Expressions) – Video #40
10. Create Reports based on Queries – Video #41
11. Export Queries from Access to Excel, Text File and pdf – Video #42

The specific steps to build Wooden Crafts database are here:

1. Create New Database.


i. After opening Access, click “Blank Desktop Database”:

Click Blank
database to
create a new
database.

ii. In the next window, click on the Browse button to save the database to the correct folder for Access:

Click the Browse


button to
choose where
the database is
saved

Page 1 of 25
iii. In the File Name textbox, type the name of the database: “WoodenCraftsDatabase”. Then click the
Create button to create the new database file.

File Name

Click Create to create


database

2. Import SupplierData Table into Database from an Excel workbook.


i. Here is a view of the new database and the automatic table that was created:

Automatic Table is open, here

Automatic Table is shown in the Navigation Pane

ii. Using Ctrl + S, name the table “Products”.

Page 2 of 25
i. Here is a view of the new database and the new Products Table. Use the Close Button for the Products
Table. We will come back and do extensive work on this table later.

This is Close Button for


the entire database.

Products Table name is seen This is Close Button for


Products Table in Tab above table shown in the automatic table that
name is seen in Datasheet View. was created.
Navigation Pane.

ii. Now we need to import the Supplier Table from the Excel File named “V39-SupplierDataFromExcel.xlsx”
(you download file from our web page).
iii. On the External Data Tab, click the New Data Source dropdown, then click on Excel.

iv. “In the Get External Data – Excel Spreadsheet” dialog box:
1. Use the Browse button to navigate to the Excel file named “V39-SupplierDataFromExcel.xlsx”.
2. Make sure that the “Import the source data into a new table in the current database” dialog
button is selected.
3. Click OK.
Make sure that Use the Browse button
the “Import the to navigate to the Excel
source data into file named “V39-
a new table in SupplierDataFromExcel.x
the current lsx”
database” dialog
button is
selected

4.
Page 3 of 25
v. In the next window you can accept the default settings:

vi. In the next window, check the check box for “First Row Contains Column Headers”:

Check the check box


for “First Row
Contains Column
Headers”

vii. In the next window, for the Supplier Code Field Name, select “Yes (No Duplicates)” in the Indexed
textbox dropdown:

Select
“Yes (No Duplicates)”

Page 4 of 25
viii. In the next window, select “Choose my own primary key” for the Supplier Code Field.

Select “Choose my own


primary key” for the
Supplier Code Field

ix. In the next window, we can accept the table name “SupplierData”. Click Finish.

x. In the last window click the Close button (window not shown)
xi. Now we can see the imported SupplierData Table in the Navigation Pane.

SupplierData Table in the


Navigation Pane

Page 5 of 25
3. Add Data Types and Field Properties to each Field in the SupplierData Table
i. As we talked about last video Data Types and Field Properties allow us to add Data Validation to our
Fields so that “Bad Data” doesn’t get into our Field.
ii. Following are two tables that list the different Data Types and the different Codes for Input Masks:

1. Different Data Types:


Data Type Usage Size
Short Text Alphanumeric data (names, titles, etc.) Up to 255 characters.
Large amounts of alphanumeric data: sentences and Up to about 1 gigabyte (GB), display
Long Text paragraphs. first 64,000 characters.
Number Numeric data. 1, 2, 4, 8, or 16 bytes.
Large Number Numeric data. -2^63 to 2^63
Date/Time Dates and times. 8 bytes.
Currency Monetary data, stored with 4 decimal places of precision. 8 bytes.
AutoNumber Unique value generated by Access for each new record. 4 bytes
Boolean (true/false) data; Access stores the numeric
Yes/No value zero (0) for false, and -1 for true. 1 byte.
Pictures, graphs, or other ActiveX objects from another
OLE Object Windows-based application. Up to about 2 GB.
Hyperlink A link address Up to 8,192 characters
You can attach files such as pictures, documents,
Attachment spreadsheets… Up to about 2 GB.
Calculated You can create an expression (formula) Dependent on the data type
The Lookup Wizard can lookup a value from another Dependent on the data type of the
Lookup Wizard column in a different table (Primary Key) lookup field.

Page 6 of 25
2. Code for Input Mask (like Number Formatting in Excel) for Field Properties:
Character Description
0 Digit (0 to 9, entry required, plus [+] and minus [?] signs not allowed).
9 Digit or space (entry not required, plus and minus signs not allowed).
Digit or space (entry not required; spaces are displayed as blanks while in Edit mode, but blanks
# are removed when data is saved; plus and minus signs allowed).
L Letter (A to Z, entry required).
? Letter (A to Z, entry optional).
A Letter or digit (entry required).
a Letter or digit (entry optional).
&; Any character or a space (entry required).
C Any character or a space (entry optional).

Decimal placeholder and thousand, date, and time separators. (The actual character used depends
.,:;-/ on the settings in the Regional Settings Properties dialog box in Windows Control Panel).
< Causes all characters to be converted to lowercase.
> Causes all characters to be converted to uppercase.
Causes the input mask to display from right to left, rather than from left to right. Characters typed
into the mask always fill it from left to right. You can include the exclamation point anywhere in
! the input mask.

** |Causes the character that follows to be displayed as the literal character (for example, \A is displayed as just A).

3. Number Field Size Properties:

Field Size Description


Byte Interger: 0 to 255
Integer Interger: -32,768 to 32,767
Long Integer Interger: -2,147,483,648 to 2,147,483,647
Single decimals with 7 significant digits: Requires 4 bytes of storage
Double decimals with > 'Single' significant digits: Requires 8 bytes of storage
Decimal decimals with > 'Double' significant digits: Requires 12 bytes of storage
Replication ID Globally unique identifier (GUID) 16 bytes of storage

Page 7 of 25
iii. First, we want to open our Supplier Table in “Regular View” or Datasheet View. In the Navigation Pane,
double-click the Supplier Data Table. We can see we have four suppliers.

SupplierData Table name is shown in Tab


above table shown in Datasheet View.

Double-click SupplierData Table in the


Navigation Pane to open the table.

iv. Now we want to view the table in Design View so that we can add the correct Data Types and Field
Properties to each Field. To show the table in Design View click the View Button in the View group in the
Home Ribbon Tab.

Click the View button to


get to Design View.

v. Design View for the SupplierData Table is seen below.


1. Notice that Fields are listed vertically.
Primary i. Notice the first field name is “Supplier Code” and that there is a key icon that indicates
Key that this is the primary key. This is the Primary Key we set during the process of
importing the Excel Table.

SupplierData Table name is shown in Tab


above table shown in Design View.

Data Types
for each Field

Fields are
Field Properties for selected Field
listed
“Supplier Code”
vertically

Page 8 of 25
vi. For the Supplier Code Field our Data Type, Description and Field Properties are:
1. Data Type = Short Text
2. Description = “Primary Key - this will be the Foreign Key in the Products Table.”
3. Field Properties are:
i. Field Size = 2
ii. Input Mask = >LL (this means letters are always capital and two letters must be entered)

vii. The remaining Data Types, Descriptions and Field Properties are seen in the following pictures, one for
each Field:
viii. First Name:

ix. Last Name:

Page 9 of 25
x. Address:

xi. City:

xii. State (State is a two capital letter abbreviation so we use input mask >LL ):

xiii. Zip Code (not a Number Data Type because we will never do math operations on this field):

Page 10 of 25
xiv. Telephone (not a Number Data Type because we will never do math operations on this field):

xv. The finished list of Fields, Data Types and Field Properties is seen below. Using Ctrl + S, Save the changes
you made to the SupplierData Table Object. Then Close the window.

After saving, click


the Close Button

Page 11 of 25
4. In Access create a Product Table and add Data Types and Field Properties
i. We already have an automatic table that was created when we created the database, and we named it
Products. Now we need to open it in Design View and add Field, Data Types and Field Properties. To
open it in Design View, right-click the Products table in the Navigation Pane and point to Design View,
like in this picture:

ii. Below is the Products Table shown in Design View. An automatic Primary Key was added with an
AutoNumber Data Type. We do not want this field in our table.

iii. To delete the field, right-click the Field Name and click on Delete Rows.

1.
iv. When the dialog box pops up, click Yes, like in this picture:

1.

Page 12 of 25
v. We now need to create our own Primary Key (Unique Identifier for each Product). For the first field in
the Products Table, our Data Type, Description and Field Properties are:
1. Field Name = Product ID
2. Data Type = Short Text
3. Description = “Product ID - Primary Key - Rule for PK = 2 Capital Letters AND 2 Numbers”
4. Field Properties are:
i. Field Size = 4
ii. Input Mask  >LL00 (this means two letters and two numbers must be entered and
letters will be capitalized)

vi. To convert the field to a Primary Key, you can right-click the Field Name and click on the Key Icon:

vii. Here is the Completed Primary Key:

Primary
Key Icon

viii. The remaining Data Types, Descriptions and Field Properties are seen on the next page. The Raw Data
for the Products Table is also seen on the next page.

Page 13 of 25
ix. You can use the below table to complete the Field Names, Data Types and Field Properties for the Products Table, however, for the last two
fields, Supplier Code and Wholesale Retail, you want to see instructions on the next few pages.

Page 14 of 25
5. Use Data Type Lookup Wizard to connect the Products table to the SupplierData table with a One-To-Many
Relationship between the two Supplier Code Fields. We will also use Lookup Wizard to create a Whole Sale
Retail Field.
x. Here are the instructions for creating the Supplier Code and Wholesale Retail fields:
xi. Supplier Code Field:
1. Type Field Name “Supplier Code”
2. Select the Data Type “Lookup Wizard”:

3. In the first dialog box, select “I want the lookup field to get the values from another table or
query”. Then click Next.

4. In the second dialog box, select the SupplierData Table. Then click Next.

Page 15 of 25
5. In the third dialog box from the Available Fields list on the left, select Supplier Code and then
click the Single Arrow Button to move the Field to the Selected Fields on the right.

Single Arrow Button

6. After you click the Single Arrow Button to move the Field to the Selected Fields on the right, the
dialog box will look like the one below. Then click Next.

7. In the fourth dialog box, select Supplier Code from the Ascending textbox dropdown. Then click
Next.

i.
Page 16 of 25
8. In the fifth dialog box, click Next.

9. In the sixth dialog box, click Finish.

10. When the next dialog box asks you to save before relationship can be created, click Yes.

Page 17 of 25
11. The finished Supplier Code Field is show. Notice how it adopted the Field Size of 2 from the
Primary Key Field in the SupplierData Table.

i. Wholesale Retail Field:


1. Type Field Name “Wholesale Retail”
2. Select the Data Type “Lookup Wizard”:

3. In the first dialog box, select “I will type the values that I want”. Then click Next.

Page 18 of 25
4. In the second dialog box, type the two values as seen below and then click Next.

5. In the third dialog box, check the box for “Limit To List”. Then click Finish.

6. The finished Wholesale Retail Field looks like this:

Page 19 of 25
ii. To Save the completed Products Table, use Ctrl + S.
iii. The Finished Products Table with Field Names, Data Types and Field Properties is seen in Design View is
seen here:

iv. Click the Datasheet View button to view the Datasheet view:

View button
to view the
Datasheet
view

v. The table has no raw data and shows no records. Click the Close Button to close the Products Table.

Products Table Close Button

Page 20 of 25
6. Use Relationship Window to add "Referential Integrity" to One-To-Many Relationship between the two
Suppliers Code fields
vi. We need to edit the relationship that was created when we used the Lookup Wizard for the Supplier
Code in the Products Table. To edit a relationship, click the Relationships button in the Relationship
group in the Database Tools Ribbon Tab.

Click the Relationships button

vii. In the Relationships Window, we can see that there is a Relationship Line between the Supplier Code
Fields in both the SupplierData Table Field List and the Products Table Field List.

viii. Using your cursor resize the Field Lists so that appear as they are in this picture:

Page 21 of 25
ix. Very carefully, hover your cursor over the Relationship Line and then Right-click and click on Edit
Relationship.

x. In the Edit Relationships dialog box, check the “Enforce Referential Integrity” check box to make sure
that you are ONLY allowed to enter a Supplier Code in the Products Table if it is already in the
SupplierData Table. This insures a One-To-Many Relationship.

Check the “Enforce Referential Integrity”


check box

xi. Note:
1. Cascade Delete Related Records check box
i. You cannot delete a record from a primary table if matching records exist in a related
table. For example, you can’t delete an employee record from the Employees table if
there are orders assigned to that employee in the Orders table. You can choose to
delete a primary record and all related records in one operation by selecting the
Cascade Delete Related Records check box.
2. Cascade Update Related Fields check box
i. You cannot change a primary key value in the primary table if doing so would create
orphan records. For example, you cannot change an order number in the Orders table if
there are line items assigned to that Order in the Order Details table. You can choose to
update a primary record and all related records in one operation by selecting the
Cascade Update Related Fields check box.

xii. We can see the One-To-Many Relationship. Next click the Close Relationship Window Button.

Click the Close Relationship


Window Button

Page 22 of 25
7. Create a Form for the Products Table
xiii. We need a Form For each of the Tables so that we can enter, edit and delete data in each table. To
create a Form for the Products Table , select the Products Table in the Navigation Pane and then click
the Form button in the Forms group in the Create Ribbon Tab.

Click the Form Button


Select the Products
Table in the
Navigation Pane

xiv. When the Form for the Products Table appears, click the View dropdown and then click on Form View.

Click the View


dropdown and
then click on
Form View

xv. Save the Products Form by using the keyboard Ctrl + S. When the Save As dialog box appears, click OK.

xvi. Using the Close Button for the Products Form, close the Products Form:

Using the Close Button for the Products Form, close the Products Form

Page 23 of 25
xvii. The Product Form now appears in the Navigation Pane:

xviii. Repeating the steps for creating a Products Table Form, create a Form for the Supplier Data
Table. After you complete the SupplierData Form and close it, the Navigation Pane will contain two
tables and two formulas, like in this picture:

8. Add data to Products table using the Products Form


i. Double-click the Products Form to open it and then enter the raw data for each record. The raw data for
each record is listed below.
1. Be sure to use the Tab Key to move to the next field. When you get to the end of the last field
for each record, hitting the Tab Key will move you to the first field in the next record.
2. Also, be sure to check each one of the Data Validation “Data Types” and “Field Properties” that
you created for this table. For example, see what happened if you type more than 4 characters
into the Product ID Field or see what happens if you type a cost of 1000 into the Cost Field.

i. The next Page shows the Products Table after all the Raw Data is Entered.
ii. This is the end of Video #39.
iii. Next Video we will learn how to create Queries in Access.

Page 24 of 25
New Keyboards in Video
1. F6 = Jump from Field Name area to Field Properties area in Table Design View

Page 25 of 25

You might also like