0% found this document useful (0 votes)
58 views

SEHH1007 Tutorial - Microsoft Access 2016 (Lab 1)

The document provides an overview of using Microsoft Access to create and manage databases. It describes how to create an Access database, add tables to the database, and modify fields in the tables. The document also defines common database terminology and lists different data types that can be used in Access.

Uploaded by

Kelly Ngan
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)
58 views

SEHH1007 Tutorial - Microsoft Access 2016 (Lab 1)

The document provides an overview of using Microsoft Access to create and manage databases. It describes how to create an Access database, add tables to the database, and modify fields in the tables. The document also defines common database terminology and lists different data types that can be used in Access.

Uploaded by

Kelly Ngan
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/ 13

Tutorial 6

Microsoft Access 2016 Lab One


Learning Outcomes
• Overview of Access
• Creating Database File
• Adding/ Deleting records of the database

Database and Database Management Systems (DBMS)


The term “database” describes a collection of related data items organized in a
manner that allows access, retrieval, and use of them. A data management system
(DBMS), such as Access, is piece of software for you to create, store, maintain and
access database files. You can add, change, delete, sort, and retrieve data in the
databases created. You can also create forms and reports using data in the
databases. The following diagram summarized the interaction among users, DBMS
and database.

User DBMS Database

Source: Exhibit 3.2, P.49 of MIS7 by Hossein Bidgoli (2017)

What is Access?
Access is a DBMS software produced by MicrosoftTM. It operates under the
Windows operating system environment, allowing you to create and process data in
a database. Its data hierarchy is arranged as Files  Tables  Fields  Records

Fields

ID Name Department Salary


98765432 Chan Tai Man ENG 12000
Records 97531246 Wong Chi Wai CS 15000
96385274 Lee Mei Ling ENG 13500

1
Access uses similar terminology as most database systems do,

A collection of similar records that are classified under the same


Table category/concept is a table or a relation. In the example above, the 3
records all classified as staff are stored in Staff table.
Aspects of information which are of business/operation interest with
Field respect to the table set up is called fields. In the example above, ID,
Name, Department and Salary are of business/operation interest
when managing staff in an organization. In this case, the database
staff table (or relation) contains these 4 fields for each data item to be
collected.
Instances/examples of the table collected are records. Each record
Record contains all the information about a single collected item in a database
table. For example, each row is a record. Each represent all
information of a single staff employed as staff.

Access allows you to create a database and tables, design a data entry form, and
generate reports or graphs from the data. A key is a field that enables you to identify
or search for a record in a table. For example, your student ID is a key in the student
record table.

Creating a Database

To create a database file,


• Click the Access icon and you will find the screen similar to the one as above.
• Choose Blank database among the available templates as shown.
• In the pop-up window, type in the new database file name (extension
ending .accdb normally) in the File Name box.
• Press the folder button there to store the database file in the place you like in
your computer (e.g. Desktop).
• Press the Create button.

A database window will then appear.

2
Opening a Database
• Choose Open Other Files in the screen previously shown.
• Select the appropriate drive or browse the appropriate folder for the file you wish
to open.
• Select the desired database file and its file name will appear in the File name box.
• Press the Open button.

Creating Tables
A database may consist of many tables. You can create your own table which is
specially designed for your database. Once you create a database file successfully,
you will see the following screen. By default, Access will prompt you to create a
table by means of datasheet view. Table1 is a temporary name of the table you are
about to make.

3
Create table under All Access Objects
On the left of the screen shown previously,
• In the All Access Objects frame, click Table1 once under Tables.
(Note: if Table1 is not found, go to the Create Tab at the top, and click Table to
create a new one. More details can be found in the Create table in Create tab
section)

• Click Home-View group, and then choose Design View as shown below.

• Enter appropriate Table Name in the blue highlighted area below.


• Click OK button.

• At the Primary Key field, enter appropriate Field Name, Data Type, and
Description.

Primary Key field

• Enter appropriate Field Name, Data Type, and Description for each other field, if
any.
• Click Save button in Quick Access Toolbar to save it.

4
Quick Access Toolbar

Save button

Create table in Create tab


• Click Create tab, then click Table Design in Tables group.
Create tab
Table Design

• Enter appropriate Filed Name, Data Type, and Description for each field to store,
if any.
• Put Primary Key to an appropriate field.
• Click Save button in Quick Access Toolbar to save it.
• Enter appropriate Table Name.
• Click OK button.

A Table Design window is displayed which allows you to modify or add fields in your
new table. Click Save button in Quick Access Toolbar to save your work. When
finished, you may close it.

Modifying the Existing Table Using Design View


Make sure you can see All Access Objects in the Navigation Pane on the left,
select (highlight) the name of the table you want to modify and click the right mouse
button then choose Design View. The Table Design window will be displayed for
you to make changes.
(Note: DO NOT double-click on the name of the table. Double-clicking will
display the Datasheet View (for data entry), see Adding Records Using
Datasheet View section.)

5
e.g. Highlight Table 1

Right-click, choose
Design View

Modifying a Field
• In the Table Design window, you can modify your fields. Each field has a name
and a data type, with optional description.

Data Types available in Access


When designing a database, you should decide the tables and fields to be used as
well as the data type for each field. Access has a number of data types, from which
you can choose, as described below,
Data Type Description Example
Short Text To store letters, numbers, and special Introduction to Access
characters (*&^%$#@!); can be up to
255 characters longs.
Long Text To store a textual data type up to about Any kind of textual
1 gigabyte (GB), but controls to display message that is often
a long text are limited to the first quite long can be stored
64,000 characters. Use this data type here.
for notes, comments, or long fields
(greater than 255 characters)
Number Contains different field sizes. The
following enlisted a few popularly used
ones.

Byte: To store small numbers with


value from 0 to 255 (no fraction). E.g.
5

Integer: To store integers from -32768


to 32767. E.g. 2018

Longer Integer: To store integers from -


2147483648 to 2147483647. E.g.
1234567

Single: To store a number with 7


significant digits. E.g. 25.32

Double: To store a number with 15


significant digits. E.g. 3.141592653589

6
Date/Time To store date and/or time values 6/19/2007 10:21:23 AM
(different formats).
Currency To store monetary values, up to 15 $5.00
digits on the left side of the decimal
point and 4 digits to the right side;
displayed in forms and reports in the
currency format.
AutoNumber A number automatically incremented 321
(or randomly generated) by Access
whenever a new record is added to a
table; it is most often used as a primary
key, maintained within Access and
cannot be changed by user.
Yes/No A data type when one of two possible Yes
answers is needed, such as yes/no,
true/false or On/Off. There are some
restrictions imposed on this data type,
so use it carefully.

Additional settings for each field can be made at the bottom, Field Properties.
Access allows you to define the following various properties for a field:

Field Property Description


Field Size Sets the maximum length for data entered in Text and Number
fields.
Format Determines how Access displays and prints data, such as
whether to display Date fields in words or just numbers.
Decimal Places Determines the number of decimal places displayed and printed
in Number and Currency fields.
Input Mask Determines how a field looks when the user is entering data.
For example, one can create an input mask for a field for
entering dates that automatically display two slashes ( / / ) or
a field for entering phone numbers that displays dash ( - ).
Caption Supplies a label for Access to use in forms and reports, instead
of the field name.
Default Value Assigns a value that Access inserts into the field in each new
record you add to the table. You can change the value during
data entry.
Validation Rule Checks the data entered in the field against set criteria to
prevent entry of invalid data.
Validation Text Defines the contents of the message that appears when a user
enters data that does not match the criteria specified in the
Validation Rule property.
Required Indicates that some data must be entered in the field before the
record can be saved (i.e., the value in the field cannot be Null).
By default, Access fields are not required.
Allow Zero Determines whether a zero-length string is a valid entry. To
Length enter a zero-length string, type “”. By default, zero-length strings
are not valid entries.
Indexed Creates an index on the field to speed up search of the field.

7
Field names can be in any string, but it is a good design to have spaces left out in
the fields for readability.
• The default data type is Short Text. Use the drop-down box to select other types.
Select the appropriate field size for a text type in Field Properties.
• Define a field to be a primary key by clicking that field and then hitting the
primary key button at the Tools group in the Design tab. There can only be
one primary key per table.

Primary key Design tab

• When you have done, click Save button in the Quick Access Toolbar to save it.
• Make sure that there is a primary key before a table can be saved.

Moving / Copying a Field


• Highlight the field you want to move/copy (click on the left most box of the field).
• Click the mouse’s right button, select Cut or Copy from the menu.
• Click on the row you want to paste your field.
• Click the mouse’s right button, select Paste button.

Inserting a Field
• Position the cursor to the field where you want to insert another field.
• Click the mouse’s right button, select Insert Rows button.
• Add the relevant information.

Deleting a Field
• Highlight the field you want to delete (click on the leftmost box of the field).
• Click the mouse’s right button, select Delete Rows button.

8
Access Exercise 1
1. Create a new database called yourname.accdb. If your name is Chan Tai Man,
then save the new database as ChanTaiMan.accdb.

2. Enter the following fields and descriptions to the table using Table Design in
Create tab.
Name Type Description Field Size
EmployeeID AutoNumber Employee ID number Long Integer
FirstName Short Text First name of employee 50
LastName Short Text Last name of employee 50
Married Yes/No Married Y/N Yes/No (format)
Birthday Date/Time Birthday (dd-mmm-yy) Medium date (format)
Address1 Short Text Address line 1 35
Address2 Short Text Address line 2 35
Address3 Long Text Address line 3
District Short Text District 15
Region Short Text Region 15
Performance Number Score (0 – 255) Byte
Position Short Text Employee position 2
Salary Currency Monthly salary Standard (format)

3. Save the table as Employee2 and close Table Design.

4. Open Employee2 in Design View. Insert the following field before Married:
Name Type Field Size Description
Gender Short Text 1 Gender F/M

5. Delete Address3.

6. Move Position after Salary.

7. Save the table and close Table Design.

8. Rename Employee2 to be Employee.

9. Close your database.

9
Adding Records Using Datasheet View
Adding Records
• At the All Access Objects in the Navigation Pane on the left, select (highlight)
the name of the table you want to add records.
• Double-click the mouse’s left button.
• The Datasheet View window is displayed with the caption names of the fields as
the column headings. Each row represents a single record.
• If there are no records in the table, then you can just enter the data field by field.
• You can use <Tab> or <Enter> to move to the next field or record.
• AutoNumber field cannot be edited. Access will assign numbers automatically.
Don’t worry even if the numbers are not consecutively listed after the insertion
and/ or deletion of records.

Resizing a Column of a Datasheet


• Position the cursor on the right boundary of the column heading with which you
want to adjust its width. The cursor will change to a short vertical line called the I-
beam. Then you can either:
• Drag the column boundary to left/ right to resize the column.
• Double-click while the cursor is changed into the I-beam. This will cause
Access to adjust the width of the column automatically to fit the data.

Saving and Closing the Datasheet


• Click Save button in Quick Access Toolbar.
• Select Close button for the table you want to close.

Deleting Records Using Datasheet View


• At the All Access Objects in the Navigation Pane, select (highlight) the name of
the table you want to add records.
• Double-click the mouse’s left button.
• The Datasheet View window is displayed with the caption names of the fields as
the column headings. Each row represents a single record.
• Highlight the field you want to delete (click on the left most box of the field).
• Click the mouse’s right button, select Cut or Delete Record from the menu.
Caution: There is no way to undelete records. Make sure that you are deleting the
right records and answer Yes on the alert message box.

Updating Records Using Datasheet View


• At the All Access Objects in the Navigation Pane, select (highlight) the name of
the table you want to add records.
• Double-click the mouse’s left button.
• The Datasheet View window is displayed with the caption names of the fields as
the column headings. Each row represents a single record.
• Position the cursor to the field of the record to be changed and click.
• The cursor will change from an arrow to an I-beam.
• You may then update the cell.

10
Caution: You can only undo the change in one previous step. Make sure the
changes you make are correct. There is no alert box this time.

Sorting Records Using Datasheet View


Records are always inserted at the end of a table. You can sort the records
according to any field, either in ascending order or in descending order.
• Open the table you want to sort in Datasheet View.
• Click on the field by which you want to sort.
• Click the Ascending or Descending button at the Sort & Filter group in
the Home tab.
Ascending button
Home tab

• The records are then sorted according to the selected field.

Modifying an Existing Table Using Datasheet View

• At the All Access Objects in the Navigation Pane, select (highlight) the name of
the table you want to add records.
• Double-click the mouse’s left button.
• The Datasheet View window is displayed with the caption names of the fields as
the column headings. Each row represents a single record.
• Highlight the field you want to insert field (click on the top most box of the field).
• Click the mouse’s right button, select Insert Field from the menu. A field will be
added to the left.
• Highlight the field you want to rename (click on the top most box of the field).
• Click the mouse’s right button, select Rename Field from the menu. Type the
new field name.
• Highlight the field you want to delete (click on the top most box of the field).
• Click the mouse’s right button, select Delete Field from the menu.
Caution: You cannot undo the deletion of a column/field and the change of name.
You need to answer Yes on the alert message box to confirm a deletion.

Managing Data Entry Form

1. Creating a Data Entry Form


The easiest way to create a form for data entry is to use the Access Form Wizard.

11
• Choose Create tab, then choose Form Wizard in Forms group.

Create tab Form Wizard

• A Form Wizard window will be displayed. In the Table/ Queries box, select the
table or query that you want to create a form for. On the left side, under
Available Fields, you will see a list of fields. You can select those fields that
need to be included in the input form.
• Select the fields using > button and click the Next button. Use the < button to
remove a field from the input form.
• Select the format of layout, say, Columnar or Tabular (for a small number of
fields) or Justified (for a large number of fields).
• Click the Next button.
• Give a name to the form and choose the Finish button.
• You will then see a form for you to enter the data.
2. Editing a Form
Whether you have created your form using Form Wizard or under Design View, you
can edit the form.
• At the All Access Objects in the Navigation Pane, select (highlight) the name of
the form you want to edit under Forms.
• Click the mouse’s right button, select Design View button from the menu.
• The Form Design View window is displayed.
• You may do the following editing if appropriate:
- Drag the fields and their captions on the form.
- Highlight items and hit <Del> to delete.
- Highlight text to change the caption/ label. Click the background to finish.
When you have finished, click Save button in Quick Access Toolbar to save it.

Modifying Records Using a Form


A form is a convenient platform for you to add a record, delete a record or modify a
record, other than editing directly in the Datasheet View. For beginners, the form is
normally more preferred since it is not easy to make a typing mistake. Please be
reminded that many mistakes in Access are irrecoverable.
• At the All Access Objects in the Navigation Pane, select (highlight) the name of
the form you want to modify records under Forms.
• Double-click the mouse’s left button.
• You will see a form displaying the records of the table.
• Use <PageUp> and <PageDown> or left triangle () / right triangle () to move
around.
• Select Insert, New Record or click to insert record (at the end).
• Enter the relevant field values for the record.
• You can change the information of any field on any record you see on the screen.
• To delete a record, locate the record you want to delete.

12
• Select Delete Record in Delete button in Records group in Home tab.
• When you have finished, click Save button in Quick Access Toolbar to save it.

Access Exercise 2
1. Open the database you created in Access Exercise 1 (yourname.accdb).
2. Open the Datasheet for Employee and insert the following records:
(Note: the table below shows information of records only. It does not show how
the Datasheet View in Access looks like.)
Name Record 1 Record 2 Record 3 Record 4
EmployeeID The value here is automatically assigned by MS Access
FirstName Ka Wah Mei Lee Chun Kit Charles
LastName Chan Wong Chan Li
Gender M F M M
Married Y N Y N
Birthday 03-Sep-86 12-Dec-80 02-Jan-83 03-Mar-86
Address1 6A, Blk 2 Rm 711, Blk 21 8/F, Tai Wah 7B, Blk 4
Bldg
Address2 23, Wing On Wah Fu Estate 11, Water Road 44, Ming Tak
Street Street
District Mong Kok Aberdeen Sheung Wan Shatin
Region Kowloon Hong Kong Hong Kong N.T.
Performance 195 220 180 120
Salary 22000 45000 33000 11000
Position EO LA AL CO
3. Close Datasheet View.
4. Create a data entry form for Employee using Form Wizard.
5. Save the form as Employee Form and insert the following 4 extra records using it.
Name Record 5 Record 6 Record 7 Record 8
EmployeeID The value here is automatically assigned by MS Access
FirstName Kwai Ming Man Yee Kar Ling Chi Shun
LastName Luk Hung Chan Mak
Gender M F F M
Married N N Y Y
Birthday 12-Nov-79 02-Feb-91 13-Apr-84 12-Aug-83
Address1 Rm 813, Blk 1/F, Chi Yun Flat G, 6/F 2/F, Tai Nam
22 Bldg Bldg
Address2 Nam Fung 981, King’s Rd 4, Waterloo Rd Tai Nam Street
Estate
District Shatin Quarry Bay Yau Ma Tei Sham Shui Po
Region N.T. Hong Kong Kowloon Kowloon
Performance 85 50 165 200
Salary 15000 11000 35000 20000
Position PS CO AL EO

6. Save the records and then close the form. Open Employee again in Datasheet
View to check if the 4 extra records are added by Employee Form successfully or not.

13

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy