Upload
karim-waleed-fayed
View
220
Download
0
Embed Size (px)
Citation preview
8/10/2019 Access Tips (Updated)
1/3
The British University In Egypt - BUE
Faculty of Business Administration, Economics & Political Science 14BMIS01C
Business Administration Department Business Information Systems
Dr. Ali Fakhri Page 1 of 3
Access Tips
When you create a Database in Access, it is preferable to create the following items with the orderas follows:
1. Tables using Design View:Table for each Entity that includes the needed Attributes or Fields.2. Relationships between Tables (Database Tools).
3. Data Entry in each Table (using Datasheet View).
4. Queries using Design View.
5. Reports using Wizard.
6. Forms using Wizard:Form for each Table and Query, with Buttons in each Form using Design View.
7. Main Menu Form with required Buttons using Design View.
N.B.: Layou t Viewis used for some purposes as mentioned later.
1. Tables
Attribute Data Type: If an attribute that its data type could be Short Text or Number, such as: D-ID, P-no,Dept-Code, Salary,etc, to decide:
If you need to do mathematical operationson this attribute, such as: +, -, *, /, etc, the data type of this
attribute must be Number (or Currency),e.g. Salary.
But, if you dont need to do mathematical operationson this attribute, the data type could either be Short
Text or Number, e.g. Dept-Code. However, it is more logic to use Short Textdata type.
On the other hand, in the D-IDand P-noattributes, in order to avoid system ignoring of the zero on the left
hand sidein some values, the data type of these attributes must be Short Text.
2. Relationships
(1M) Relation
Copy the Primary Key (PK) of Table of 1to Table of M.The copy of PK is called the Foreign Key (FK).
(MM) Relation
Create a new table (Bridge Table) to break (MM) relation into two (1M).This new table contains 3 attributes:
a copy of each PK of the 2 tables that have (M-M) relation (i.e. 2 FK), and
any new attribute as a PK (for this new table) with Autonumber as its data type.
N.B.:Both the PK and FK must have both the same data types and the same values in Data Entry.
Dont use Auto-number data type for a PK attribute, to avoid problems when creating the relationships.
Do the following steps, after creating the Relationships in Access, to generate a Report for the
Relationship and also to save it as a PDF file:
Database Tools Relationships Relationship Report Page Setup: Portrait, PDF.
3. Data Entry
Some attributes in different Tables may contain the same values due to the relationship between
these tables.For example, the Specializationattribute in DoctorTable, and Complaintattribute in Patient
Table, and Dept-Namein DepartmentTable; all these 3 attributes contain the same values that are: Eye,
Children, Bone, and Brain.
In case of (1M) relation, you must start entering data in Table of 1 and after filling all its records,
you can then start entering data in Table of M. For example, you must enter all needed data in
Department Table (1 Table)firstand then DoctorTable (M Table), as relation between Department
Doctor is (1M).
N.B.: In Datasheet View, you can click on the +sign at the left hand side of each record; to view the relatedrecord(s) in the other table (that has a relationship with that table).
8/10/2019 Access Tips (Updated)
2/3
The British University In Egypt - BUE
Faculty of Business Administration, Economics & Political Science 14BMIS01C
Business Administration Department Business Information Systems
Dr. Ali Fakhri Page 2 of 3
4. Queries
A Query is used to select specific records according to a certain given criteria, from one or more Tables.
Query is simply a small table with somedata included from the original Table(s).
5. Reports
A Report could be generated from 1 or more: Tables or Queries.A Report includes someattributes of
the original Table(s) or Query(s). A Report is used to group dataaccording to a certain attribute(s).
A Report may use functions such as: sum, count, etc. using Layout View Design Totals.
6. Forms
Make a Form for each Table and Query.
A Form should include all the attributes of the original Table or Query.
For each Form, do the following steps:
For example, the Doctor Formof Doctor Table,
Open Doctor Form,View Design View,
- Design Controls: Button,
Record Navigation, Go to Next Record Picture, Go to Next Finish.
- Design Controls: Button,
Record Navigation, Go to Previous Record Picture, Go to Previous Finish.
- Design Controls: Button,
Record Operations, Add New Record Picture, Pencil (Edit) Finish.
- Design Controls: Button,
Record Operations, Delete Record Picture, Delete Record Finish.
- Design Controls: Button,
Form Operations, Close Form Picture, Stop Finish.
View Form View(to try buttons added).
For each Table Form created (i.e. Doctor, Patient, Department, Manager, Doctor-Patient) do the
following steps:
For example, the Doctor Formof Doctor Table,
Open Doctor Form,View Design View,
- Design add Logo: suitable picture,Title: Form,Date and Time.
- Highlight all text edit from Home.
View Layou t View,
- Select Form background change its colour from Home.
- Homeknow how to use: Sort (Ascending or Descending),and Findto search for a specific field
within a record.
7. Main Menu Form
Create BlankForm,
View Design View,
Right-click Fill/Black Colour:choose Form background colour.
Design Controls: choose Aa, write: Tables; choose Aa, write: Queries; choose Aa, write: Reports.
Design add Logo: suitable picture, Title:Main Menu.
Highlight all text edit from Home.
8/10/2019 Access Tips (Updated)
3/3
The British University In Egypt - BUE
Faculty of Business Administration, Economics & Political Science 14BMIS01C
Business Administration Department Business Information Systems
Dr. Ali Fakhri Page 3 of 3
Design Controls: Button,
Form Operations, Open Form Doctor Open the form and show all records Text, write:
Doctor Finish.
N.B.: You must repeat this step for each item created in your database (i.e. all Forms, and all
Queries, and all Reports and Relationship Report), to add buttons for each item in Main Menu. Design Controls: Button,
Application, Quit Application Picture, Stop Finish.
View Form View (to try buttons added).
Close Main Menu Form and name it as Main Menu.
File Options Current Database Display Form: Main Menu Ok.
N.B.:You can also see the Main Menu Form on Youtube. Open Youtube, and then write in it: "Creating a Main
Menu Form and Buttons in an Access Database". You will find several videos, e.g.:
http://www.youtube.com/watch?v=bqs8LIgKZTA
N.B.:You can right-click on each Table, and Query, and Report Export Word.
N.B.:You could refer to the solved database exampleHospital CompleteAccess file (taken in theLab
Exercises)uploaded on the e-learning for more details.
Extra Point (Optional) Relationships
(11) Relation
Copy the Primary Key (PK) of any of the 2 Tables and put it in the other Table. The copy of PK is called
the Foreign Key (FK).
Adjust the properties of the FK as follows:
Right click on Table that has FK,View Design View,
Stand with mouse on FK attribute, go toGeneral at bottom part ofDesign ViewRequired: Yes,
Indexed: Yes (No Duplicates).
Close Table Database Tools, Relationships: connect the 2 Tables.
View Datasheet View,
Insert data into the new attribute added (i.e. FK).
N.B.:You should make a new Formfor the Table to include the new attribute added.
http://www.youtube.com/watch?v=bqs8LIgKZTAhttp://learn.bue.edu.eg/course/view.php?id=12http://learn.bue.edu.eg/course/view.php?id=12http://learn.bue.edu.eg/course/view.php?id=12http://learn.bue.edu.eg/course/view.php?id=12http://learn.bue.edu.eg/course/view.php?id=12http://learn.bue.edu.eg/course/view.php?id=12http://learn.bue.edu.eg/course/view.php?id=12http://learn.bue.edu.eg/course/view.php?id=12http://learn.bue.edu.eg/course/view.php?id=12http://learn.bue.edu.eg/course/view.php?id=12http://www.youtube.com/watch?v=bqs8LIgKZTA