MS Access Tutorial
MS Access Tutorial
Microsoft ACCESS 97
Microsoft Access 97 is a Database Management System (DBMS), it consists of a
database(s) and the information handling applications needed to access it. MS Access can
help you create, maintain, and report on data and table relationships in a database.
An Overview of Database
Database
A database consists of one or more than one tables in which data are stored and managed.
Inside the database, tables work together with queries and reports to produce the required
output.
Table
A table consists of records, which is the data about a particular subject. E.g. a database
might contain a table of data on students (names, student ID, address, telephone number)
Field
A field is a single unit of data, such as a person's name or an address or even a telephone
number. A field generally appears as a single column in a table.
Form
A form is an interface, which display data or allow users to input and edit data.
Query
A query is a special database feature that allows a user to ask questions and execute
commands. When performing a query, you can set conditions for selecting records. It is
usually used to summarise or update data such as sorting, filtering, joining tables, and
performing calculations.
1
Introduction to Microsoft Access 97
Create a database
Create a table
To create a table
2
Introduction to Microsoft Access 97
Choosing Fields for your table
1. Click the Business option button
2. In the Sample Tables list, click Employees.
3. In the sample fields list, double-click the field names listed in the table below to add
them to the table you are creating. Fields are:
EmployeeID, FirstName, LastName, Title, Salary.
3
Introduction to Microsoft Access 97
3. Move the cursor to the last row and enter a new record
To delete record
1. Position the mouse pointer on the row selector of the record to be deleted
2. Click the row selector to select the whole record
4
Introduction to Microsoft Access 97
4. Click the Yes button to complete the deletion, or click the No button to cancel
deletion
To create a form
1. By clicking the AutoForm button in the toolbar, or from menu Insert -> AutoForm,
Access instantly creates the form for entering and editing Friends data. The form
contains one control for each field in your table, though some of those might be
scrolled off the bottom of the form window at the moment.
Toolbar Menu
1. Start from the database window, and click the Forms object tab.
5
Introduction to Microsoft Access 97
2. Double-click the Employees form name, or highlight the form name and choose
Open. Your data will appear in form view.
6
Introduction to Microsoft Access 97
Records are sorted by surnames. You can follow steps 1 through 4 to sort on any field in
your table. To put records back in their original order, choose Records -> Remove
Filter/Sort.
7
Introduction to Microsoft Access 97
Querying a database
8
Introduction to Microsoft Access 97
4. Click Add button in the Show Table dialog box to add related table and click Close
button.
9
Introduction to Microsoft Access 97
or
• Click column in grid, click arrow and the click field you want.
10
Introduction to Microsoft Access 97
To use wildcards
• The following wildcard characters are used to search field values in queries:
Character Usage Example
* Matches any number of characters. It can LIKE Ma*
be used as the first or last character in the finds Ma, Mak, and Make
character string.
? Matches any single alphabetic character. LIKE C?m
finds Cam, and Com.
[] Matches any single character within the LIKE n[iu]ll
brackets. finds nill and null
! Matches any character not in the brackets LIKE b[!ae]ll
finds bill and bull but not bell
- Matches any one of a range of characters. LIKE c[a-c]ll
You must specify the range in ascending finds call, cbll, and ccll
order (A to Z, not Z to A)
# Matches any single numeric character LIKE B#20
finds B220, B320, and B420
• Click the Criteria entry, type LIKE followed by the text with wildcard character.
11
Introduction to Microsoft Access 97
Using calculated fields
12
Introduction to Microsoft Access 97
To run query
Creating report
A report is an effective way to present your data in a printed format. Because you have
control over the size and appearance of everything on a report, you can display the
information the way you want to see it.
13
Introduction to Microsoft Access 97
5. Click OK.
AutoReport: Columnar
AutoReport: Tabular
14
Introduction to Microsoft Access 97
4. When the Report Wizard dialog box comes up, click on the button to include all
the fields from Available Fields. Click on the Next button to continue
15
Introduction to Microsoft Access 97
5. Select a field for group level, then click the Next button to continue
16
Introduction to Microsoft Access 97
7. Choose Layout and Orientation, a preview is shown on the left
9. Finally, type a name for the report and click the Finish button to preview the report
17
Introduction to Microsoft Access 97
18
Introduction to Microsoft Access 97
Exercise
Exercise 1
1. Create a new database MyData.mdb and a new table Employees with the following
fields
EmployeeID, FirstName, LastName, Title, Salary
2. Close the table
Exercise 2
1. Open MyData.mdb and the created table Employees
2. Input the following data
Employee ID First Name Last Name Title Salary
1 Bruce Lee CEO $100,000.00
2 Jackie Chan Marketing Manager $50,000.00
3 Victor Li IT Manager $50,000.00
4 Sandy Lam Personnel Manager $50,000.00
5 Shirley Kwan Accountant $40,000.00
6 Leon Lai Account Officer $15,000.00
7 Linda Wong Clerk $11,000.00
8 Alan Tam Clerk $9,000.00
9 Danny Chan Clerk $8,500.00
10 Jacky Cheung Office Assistant $6,000.00
3. Close the table
Exercise 3
4. Create a form by AutoForm and name it as Employees
5. Close the form
Exercise 4
1. Open MyData.mdb
2. Delete record number 6 in the Employees table
3. Change Jacky Cheung's salary to $6,800
4. Add the following record
Bill / Gays / Sanitary Engineer / $4,500
5. Close the table
19
Introduction to Microsoft Access 97
Exercise 5
1. Open MyData.mdb
2. Sort your records by Last Name
3. Return to the original order
Exercise 6
1. Open MyData.mdb
2. Filter records with First Name starting with "S"
3. Show all records again
Exercise 7
1. Create a query with fields FirstName, LastName, Salary
2. Only employees' first name starting with "S" and whose Salary are between $7,000
and $50,000 should be shown
3. Add a calculated field that computes employees annual payment
20
Introduction to Microsoft Access 97
Exercise 8
1. Create a report in your favourable format
2. Print the report
21