Ms Access 2010: Presented by Mohamad Zakie Shafie Pegawai Teknologi Maklumat F44 Hospital Tanah Merah

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 28

MS ACCESS 2010

Presented by Mohamad Zakie Shafie


Pegawai Teknologi Maklumat F44
Hospital Tanah Merah
Objektif

Mengetahui kegunaan antaramuka dan ciri-ciri MS Access


Membina dan merancang pangkalan data
Mengendalikan data di dalam Table.
Membuat Form dan Queries.
Menghasilkan Report dari Pangkalan Data
Course Outlines

DAY 1
Part 1 : Understand of Database Concept & Terminology
Part 2 : MS Access Interface
Part 3 : Working with Table, Queries, Form and Report
DAY 2
Part 4 : Working with Table
Part 5 : Working with Queries
Part 6 : Working with Form and Form Wizard
Part 7 : Working with Report and Report Wizard
Part 1 : Understand of Database Concept
& Terminology
Database based collection of data. Simple DB is phonebook.
Data - organized in some manner so that the information contained within the
database can be easily retrieved.
Field (Column) : a single piece of information. Could be a name, or a number. In
some cases, it may even be a null or empty value
Record (Row) : a collection of related fields. A number of pieces of information that
relate to the same object.
Contoh rekod pekerja : nama, nokp, jawatan, penempatan, alamat, notel, emel dll.
Database is collection of tables. Cth Di Klinik, perlu table pekerja, table pesakit,
table rekod rawatan harian pesakit.
Combination of table akan membentuk satu DB.
Part 1 : Understand of Database Concept
& Terminology (Cont..)
What different MS Access (Relational DB) vs MS Excel ?
Example : company records on a series of Excel spreadsheets, we want to pull
information from each table from spreadsheets, use information as one
spreadsheet as basic.
Relational DB - allows users to create, maintain, and query your data in the
related tables.
Others Relational DB - Microsoft SQL Server, Oracle, FoxPro, Rbase dll
What different MS Access with Other RDB ? Desktop DB Intended for 50,000
records (small scale of application) not more than 3 concurrent user.
Access allow 1 Gb size or contain 32,768 Objects. Objects being tables, queries,
reports, etceverything is kept in a single container. Files extension mdb
Part 1 : Understand of Database Concept
& Terminology (Cont..)
Primary Key vs Foreign Key ?
Primary Key - a value that is unique to each record.
Foreign Key - a primary key of one table included in another table.
Primary Key

EmployeeID Name Hire Date


1122 Bill White 1/1/2001
2387 Ron Smith 9/27/2001
4456 Greg King 8/24/1999

Employee Table
Part 1 : Understand of Database Concept
& Terminology (Cont..)
CustomerID Name Address Phone Number
100 Lyons 123 A Street 916-444-5585
101 Dennys 435 Elm Street 916-478-2325
102 IHOP 654 17th Avenue 916-458-7714

Customer Table

Order Number Customer Number SalesID Cost


101 100 1122 $23.78
145 100 2387 $145.25
152 102 2387 $54.89
Orders Table
Part 1 : Understand of Database Concept
& Terminology (Cont..)
What type of user requirement / What you want to record ?
STUDENT
What objects involve for user requirement ?
STUDENTS HALL - TUTOR
What elements of each object ?
STUDENTS (StudNo, Name, Gender, UserID, Hall, Tutor)
HALL (Name, Address, NoR, Meal,)
TUTOR (Name, Subject, etc)
What Primary Key for each object ?
STUDENTS (StudNo,)
HALL (Name,..
Part 2 : Microsoft Access Interface

Four main database elements covered in this class.


Tables Data collection objects
Queries Questions of your data
Forms Predefined format to display or enter data
Reports Printable version of database information
Part 2 : Microsoft Access Interface..
(Cont)
Object Design What Can Do
Table Datasheet View Sort & Filter; Add/Save/Delete
Queries Datasheet View Sort & Filter; View/Record Manage
Form Form View Sort & Filter; Add/Save/Delete
Report Report View View and Print
Part 3 : Working with Table View, Form
View, Queries and Report View
Part 3 : Working with Table, Form,
Queries and Report (Cont..)
Part 4 : Working with Table

Sorting Selection Advanced

Ascending Equal Filter by


Descending Not Equal Form
Contain Advanced
Not Contain Filter
Part 4 : Working with Table
Data Type Type of Data for field. Example Text, Number, Date, etc..
Field Properties
Example 1 : Age (Data Type : Number); How we control the number input.
Example 2 : Gender (Data Type : Text); How we get gender from list or table. How
to display etc (Combo List or Droplist)

Table Design View


Part 4 : Working with Table(Cont)
Table Data Type
Data Description
Text Short, alphanumeric values, such as a last name or a street address

Memo Long blocks of text and text that use text formatting. A typical use of a Memo field would
be a detailed product description.
Number Numeric values, such as distances. Note that there is a separate data type for currency

Date and Time Dates and times

Currency Monetary values

Auto Number Numbers that are automatically generated for each record.

Yes or No Boolean values

OLE Object OLE objects, such as Word documents

Hyperlink Hyperlinks, such as e-mail addresses, Web Pages

Attachment Files, such as digital photos. Multiple files can be attached per record. This data type is not
available in earlier versions of Access
Calculated

Lookup Wizard Value determined on the fly, based on another value


Part 4 : Working with Table(Cont)

Table Datasheet View

Note :
Combo Box One data display at on time when transform to Form
List Box All list display when transform to Form
Part 4 : Working with Table(Cont)
Character of Input Mask
Character Explanation
0 User must enter a digit (0 to 9).
9 User can enter a digit (0 to 9).
# User can enter a digit, space, plus or minus sign. If skipped, Access enters a blank space.

L User must enter a letter.


? User can enter a letter.
A User must enter a letter or a digit.
a User can enter a letter or a digit.
& User must enter either a character or a space.
C User can enter characters or spaces.
.,:;-/ Decimal and thousands placeholders, date and time separators. The character you select
depends on your Microsoft Windows regional settings.

> Coverts all characters that follow to uppercase.


< Converts all characters that follow to lowercase.
! Causes the input mask to fill from left to right instead of from right to left.
\ Characters immediately following will be displayed literally.
Characters enclosed in double quotation marks will be displayed literally.
Part 4 : Working with Table(Cont)
To do this ... Validation Rule for Fields Explanation
Accept letters (a - z) only Is Null OR Not Like "*[!a-z]*" Any character outside the range A to Z is rejected. (Case insensitive.)
Any character outside the range 0 to 9 is rejected. (Decimal point
Accept digits (0 - 9) only Is Null OR Not Like "*[!0-9]*"
and negative sign rejected.)
Letters and spaces only Is Null Or Not Like "*[!a-z OR "" ""]*" Punctuation and digits rejected.
Digits and letters only Is Null OR Not Like "*[!((a-z) or (0-9))]*" Accepts A to Z and 0 to 9, but no punctuation or other characters.
Exactly 8 characters Is Null OR Like "????????" The question mark stands for one character.
Is Null OR Between 1000 And 9999 For Number fields.
Exactly 4 digits
Is Null OR Like "####" For Text fields.
Positive numbers only Is Null OR >= 0 Remove the "=" if zero is not allowed either.
100% is 1. Use 0 instead of -1 if negative percentages are not
No more than 100% Is Null OR Between -1 And 1
allowed.
Not a future date Is Null OR <= Date()
Requires at least one character, @, at least one character, dot, at
Is Null OR ((Like "*?@?*.?*") AND
Email address least one character. Space, comma, and semicolon are not
(Not Like "*[ ,;]*"))
permitted.
Same as setting the field'sRequiredproperty, but lets you create a
You must fill inField1 Not Null
custom message (in theValidation Textproperty.)
It is better to use a lookup table for the list, but this may be useful
Is Null OR "M" Or "F"
Limit to specific choices for simple choices such as Male/Female.
Is Null OR IN (1, 2, 4, 8) The IN operator may be simpler than several ORs.
The Yes/No field in Access does not support Null as other databases
do. Tosimulate a real Yes/No/Null data type, use a Number field
Yes/No/Null field Is Null OR 0 or -1
(size Integer) with this rule. (Access uses 0 for False, and -1 for
True.)
Part 4 : Working with Table(Cont)
Field Properties

Characteristic Description
Field Size Menentukan saiz character input
Format Nombor+Huruf
Input Mask

Caption Akan di paparkan pada field table


Validation Rule

Validation Text
Part 5 : Working with Queries

Primary function of DB.


Construct queries or questions of the data that allow the user to reach into all
the great tables you create, and pick out the stuff they need, quickly and
easily.
Queries allow you to perform the following tasks
Display selected fields and records
Sort
Perform Calculations
Generate data for forms, reports, graphs, etc...
Update existing data
Find and display data from 2 or more tables
Part 8 : Working with Queries(Cont.)

The most common type of criteria query use arithmetic operators to set the
rules.
Arithmetic Operator - restrict the data to what you need to see; results (called
datasets) from a query are a snapshot in time; adds or changes a record need to
rerun.
Logical Operator - needed to build a query; time to bring the queries into the
context of a relational database
Table Relationships
Part 5 : Working with Queries(Cont.)

Calculated Queries
Example What effect a ten percent discount of your product.
Aggregate Queries
Access are a used to create and view some common statistics about a field in a
table. Statistics on the same field, so start by dragging that field to the QBE grid as
many times as necessary.
Totals toolbar button . This will add another
Field to be QBEGrid.
Part 5 : Working with Queries(Cont.)
To includes records that.. Use this Criterion Query Result
Exactly match a value, such as China "China" Returns records where the CountryRegion field is set to China.
Returns records where the CountryRegion field is set to a
Do not match a value, such as Mexico Not "Mexico"
country/region other than Mexico.
Returns records for all countries/regions whose names start with
Begin with the specified string, such as U Like U*
"U", such as UK, USA, and so on.
Do not begin with the specified string, Returns records for all countries/regions whose names start with a
Not Like U*
such as U character other than "U".
Contain the specified string, such as Returns records for all countries/regions that contain the string
Like "*Korea*"
Korea "Korea".
End with the specified string, such as Returns records for all countries/regions whose names end in "ina",
Like "*ina"
"ina" such as China and Argentina.
Do not end with the specified string, such Returns records for all countries/regions that do not end in "ina",
Not Like "*ina"
as "ina" such as China and Argentina.
Contain null (or missing) values Is Null Returns records where there is no value in the field.
Follow a value, such as Mexico, when Returns records of all countries/regions, beginning with Mexico and
>= "Mexico"
sorted in alphabetical order continuing through the end of the alphabet.
Part 5 : Working with Queries(Cont.)
To includes records that.. Use this Criterion Query Result
Fall within a specific range, such as A Returns records for countries/regions whose names start with the
Like "[A-D]*"
through D letters "A" through "D".
Match one of two values, such as USA or
"USA" Or "UK" Returns records for USA and UK.
UK
Contain one of the values in a list of In("France", "China",
Returns records for all countries/regions specified in the list.
values "Germany", "Japan")
Contain certain characters at a specific Right([CountryRegion], 1) Returns records for all countries/regions where the last letter is
position in the field value = "y" "y".
Part 6 : Working with Form and Form
Wizard
Get from Table or Query
Part 6 : Working with Form and Form
Wizard(Cont)
Part 7 : Working with Report and Report
Wizard
Source data from Table or Query

You might also like