Upload
ahmad-zaki
View
227
Download
0
Embed Size (px)
Citation preview
8/2/2019 Lab 6 Access
1/13
1 IntroductionMicrosoft Access is one the Database Management Software (DBMS) available from Microsoft.It provides a range of functionality as needed to create a database application such as Students
Database.
There are several terms that you should familiarize with. The terms that you need to know are
Table, Forms, Queries and Reports. Refer notes for details.
Bytheendofthissectionofthe practical,thestudentsshould beableto:
Creating a new database
Create and inserting data into table
Creating a form using the Form WizardGenerate a report using the Report Wizard
8/2/2019 Lab 6 Access
2/13
1.1 Step byStepIn this lab, you are required to create a simple new database for student. It will be only include
one table that is Student. It will contain the information of student.
1.1.1 Creatinga New Database1. Open Microsoft PowerPoint. SelectAll ProgramsMicrosoft PowerPoint.
2.
A dialog box will appear as below.
3. There are three options; creating new database using blank, creating new database usingwizards and opening an existing file.
4. As for this example, select creating new database using BlankAccess Database.5. ClickOK.6. Then, a window will appear. Define the location to save the file at My Document name
the database as Student. Then clickCreate.
8/2/2019 Lab 6 Access
3/13
7. The window of database will be shown.
1.1.2 Creating A Student Table
Before you want to create the table, you should identify what information that you want to save
in that table. As for this lab, Student table should have the studentID, name, gender, contact
number, date of birth and CGPA result.
1. Double click at Create table in Design view.2. The Table Design window will appear as below.
3. There are three columns in this window. You have to define the fieldname and datatype. As fordescription, it is optional. Default value for data type is text. To change the
value, click at the arrow to open the drop down menu and select the new value.
8/2/2019 Lab 6 Access
4/13
4. Enter the data as shown in the figure.
1.1.3 Defining Primary Key
The primary key is used to make the value unique between each field. It is needed to identify and
retrieve a record that we want to.
As in this lab, the primary should be studentID because it is unique from each student.
1. Click at studentID field.2. You may find the key button from the tool bar OR right mouse click and select Primary
Key.
3. The key symbol will appear to the left of studentID field.
4. After finished, close the table design window. You will be asked to save the table. Save itas Student.
Only one primary key allowed to be defined. Please choose an appropriate
primary key.
8/2/2019 Lab 6 Access
5/13
1.1.4 Design Viewand Data View
1. Design Viewy Allows user to modify the table design.
2. Data Viewy Allows user to enter data into the table.
1.1.5 Entering Datainto Table (Data View)
1. Select Data View OR double click at Student table.2. Then, the student table will appear. You may change the column width by dragging the
divider of the column.
3. Enter the data into the related field based on the example given.
4. Save and close the Student table.
12
8/2/2019 Lab 6 Access
6/13
1.1.6 Creating A Form
Forms provide users a graphical method of entering and updating data into the database. It is
because the users may not directly involved handling the data in the database. This method
simplifies the way of data entry and retrieval, while ensuring unauthorized database access.
Forms may be created using Form Wizard and Design View. As in this lab, we will be using the
Form Wizard.
1. Select Forms in the left window as shown below.
2. Double click at the Create form by using wizard.3. A Form Wizard window will appear.
i
ii iii
8/2/2019 Lab 6 Access
7/13
i) Table/Query drop down menu allows user to choose field from different table orquery.
ii) The Available Fields listing the field that available form the table or queryselected.
iii) The SelectedFields is the listing of the chosen field from user.
4. Click at the Table/Query drop down menu and select the appropriate table or query. Inthis lab only Student table is available to select.
5. Select all of the available field by clicking at .Alternatively, you may individually select and deselect the field.
6. ClickNext. Select the form of layout as Columnar.
7. ClickNext. Select a style to apply. In the example is Standard.
8. ClickNext. Enter the title of form as Students.
9. Select Open form to view or enter data.
10. ClickFinish.
8/2/2019 Lab 6 Access
8/13
1.1.7 Usinga Form
Record selector is provided at the bottom of the form. It is used to navigate through the records
and add new record.
Number in the window indicates the number of current record.
As in the figure record shown is record number 1 out of 5 record.
1.1.8 Entering Data
1. From the record selector, select new record button
2. Enter the data of student into the new record.
3. Try to enter the data of existing student. What happen?
4. It is not allowed because the primary key is redundant.5. Close the Students form by clicking at .
Go to first record
Go to last recordGo to next record New record
The data that is entering using the form will be also updated into the
table.
8/2/2019 Lab 6 Access
9/13
1.1.9 Creating A Report
Report may be created using Report Wizard and Design View. In this lab, we are using the
Report Wizard.
1. Select Records in the left window as shown above.2. Double click at the Create report by using wizard.
3. A Report Wizard window will appear.
4. Select The Available fields from Student table to the selected fields. You may select onlyinterest field that you want to be printed.
As in the example, all fields are selected except for gender and dateofbirth.
5. ClickNext. The selected field may be grouped into level of precedence. In this example
we use the initial order.
8/2/2019 Lab 6 Access
10/13
The records in the generated report can be assorted in ascending or descending order for
up to four fields.
In this example, record is sorted by CGPA and then on Name.
6. Click on the drop down menu to select the field. The default order is ascending (A-Z) can
be change to descending (Z-A).
7. ClickNext. Now you need select the report layout.
8. Use the default value that is columnar and portrait for the orientation.
9. ClickNext. Select the style of the report as Corporate.10. ClickNext. Enter the report name as Student.11. ClickFinish.
8/2/2019 Lab 6 Access
11/13
12. The report is created and viewed for you. Then, you have to modify the report in DesignView.
1.1.10 Editingthe Report
1. Click at Design View button.
2.
2. Design View breaks the report into four sections.Report Header: Appear in the first page of report. Contain the title of report
Page Header:Contain the column names and line
Detail:Contain the details of the column name
Page Footer:Contain current date and time and also page number.
3. Alter the size and space between each item by clicking at each of small black square.
4. Delete any item that is not needed. For example you do not want the date to be printed.You may simply delete the =Now().
5. After done with editing, view the report. Click at preview button .
8/2/2019 Lab 6 Access
12/13
6. The report should be edit and the result should be the same as in the example.
8/2/2019 Lab 6 Access
13/13
1.2 S
elfReview Questions
1. How to defined the data type of information that entered in the field?
2. Why we need to define primary key?
3. What is the difference between creating table in design view and creating table by usingwizard?
4. What is the usage of field description column in table design view?
5. Describe the use of report in the database.
6. Access provided two views that are design view and data view. What is the usage ofthese two views.