1.introduction to databases in access 2007

12
1 INTRODUCTION TO DATABASES IN ACCESS 2007 This topic includes: opening Access 2007 starting a new database setting up database fields and assigning data types about the Primary key switching views entering data closing and re-opening the database Opening Access 2007 If you are opening Access 2007 using a University of Portsmouth computer: 1. Click on the Start button at the bottom left hand corner of your screen. 2. Scroll the mouse up to General Applications. 3. Select the Microsoft 2007 option. 4. Select the Microsoft Access 2007 option. Microsoft Access 2007 should open on your screen. If you are opening Access 2007 from elsewhere you may have different arrangements such as a toolbar with buttons or a short cut button on your desktop. If you cannot find it use the Start button as described above. You s hould find Microsoft or Microsoft Office 2007 on the Start menu instead of General Applications and you should b e able to find Acc ess 2007 that w ay. If you have Microsoft Office Home Edition 2007 Access will not be available to you unless you buy it separately. It is only included with Microsoft Office 2007 Professional Edition.

Upload: selvan999uk

Post on 07-Apr-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1.Introduction to Databases in Access 2007

8/6/2019 1.Introduction to Databases in Access 2007

http://slidepdf.com/reader/full/1introduction-to-databases-in-access-2007 1/12

1

INTRODUCTION TO DATABASES IN ACCESS 2007 

This topic includes:

• opening Access 2007

• starting a new database• setting up database fields and assigning data types

• about the Primary key

• switching views

• entering data

• closing and re-opening the database

Opening Access 2007 

If you are opening Access 2007 using a University of Portsmouth computer:

1. Click on the Start button at the bottom left hand corner of your screen.2. Scroll the mouse up to General Applications.3. Select the Microsoft 2007 option.4. Select the Microsoft Access 2007 option.

Microsoft Access 2007 should open on your screen.

If you are opening Access 2007 from elsewhere you may have differentarrangements such as a toolbar with buttons or a short cut button on your desktop.If you cannot find it use the Start button as described above. You should findMicrosoft or Microsoft Office 2007 on the Start menu instead of GeneralApplications and you should be able to find Access 2007 that way. If you haveMicrosoft Office Home Edition 2007 Access will not be available to you unless youbuy it separately. It is only included with Microsoft Office 2007 ProfessionalEdition.

Page 2: 1.Introduction to Databases in Access 2007

8/6/2019 1.Introduction to Databases in Access 2007

http://slidepdf.com/reader/full/1introduction-to-databases-in-access-2007 2/12

2

The Access 2007 screen and toolbars 

When Access 2007 opens you will see the screen below.

If you want to practice using a database in Access 2007 you can do so bycompleting the following activities. If you would prefer to use the skills on your owndatabase read the instructions and apply them to your work.

Starting a new database 

1. Click on the Blank Database icon towards the top of the screen.

This will open the Blank Database panel down the right-hand side of the screen.

Page 3: 1.Introduction to Databases in Access 2007

8/6/2019 1.Introduction to Databases in Access 2007

http://slidepdf.com/reader/full/1introduction-to-databases-in-access-2007 3/12

3

2. Give the database a meaningful name in the File Name: box.3. Click on the Create button.4. A table has been created for you to enter your data into. You can now go ahead

and enter your data.

To do this

i. Click the right-hand mouse button on the Add New Field heading.ii. From the drop-down menu that appears select the option Rename

Column (see illustration below).iii. Type in a new name for the column.

You can create as many columns as you need in this way.

Page 4: 1.Introduction to Databases in Access 2007

8/6/2019 1.Introduction to Databases in Access 2007

http://slidepdf.com/reader/full/1introduction-to-databases-in-access-2007 4/12

4

If you prefer to you can define the column headings and data types in Design View.This gives you more control over the table.

1. Click on the View button on the Home tab of the Command ribbon at the top ofthe screen.

2. As you see, a small drop-down menu appears with two options. You arecurrently in Datasheet view, click on the Design View button.

3. Access 2007 will require you to name the table before changing views. Give thetable an appropriate name in the Save As dialogue-box and click on the OK 

button. You cannot do anything with a table until you have named and saved it.The database has already been saved so it is just the table you are saving. Giveit a name that will represent the data you are putting into it and that you will beable to identify at a later date.

Page 5: 1.Introduction to Databases in Access 2007

8/6/2019 1.Introduction to Databases in Access 2007

http://slidepdf.com/reader/full/1introduction-to-databases-in-access-2007 5/12

5

You will be switched to Design view.

Setting up database fields and assigning data types

Fields can be thought of as the column headings for your table. While you are inDesign view you will set up the fields and assign data types.

Records are the information put into the fields, e.g. if you had a database for studentrecords, a record would be the data entered for one particular student.

This table is going to contain the names, addresses, phone numbers, dates of birth

and courses of students in a college.

1. In the first row of the database under the heading Field Name, type in the wordsStudent Number.

2. By default it will assign the Text data type. You want to assign this field theAutoNumber data type. This means that each student will be given a uniquenumber that cannot be duplicated. Click on the drop-down box under the DataType heading and select the option AutoNumber by clicking on it.

Page 6: 1.Introduction to Databases in Access 2007

8/6/2019 1.Introduction to Databases in Access 2007

http://slidepdf.com/reader/full/1introduction-to-databases-in-access-2007 6/12

6

3. Under the heading Description type the words Student’s unique ID number.This is a description of the data that the field holds. In a more complex databasewith more complex data this would be a useful means of distinguishing all thedifferent data types.

4. Fill in the rest of the field names as follows assigning the data types noted andadding appropriate descriptions.

Field Name Data Type First name TextSecond name TextStreet address TextTown TextTelephone number Text – although it is a collection of numbers it is not being treated as

a number. A number would be something that you might sort intonumerical order, use in calculations etc. The telephone number issimply information in the same way as the name is.

Date of birth Date – it is useful to treat this as a date rather than text because you

may want to do a breakdown of student age etc.Course name Text

Page 7: 1.Introduction to Databases in Access 2007

8/6/2019 1.Introduction to Databases in Access 2007

http://slidepdf.com/reader/full/1introduction-to-databases-in-access-2007 7/12

7

Data types

Text Use for text or combinations of text and numbers, such asaddresses, or for numbers that do not require calculations, suchas phone numbers, post codes. You can use up to 255

characters.Memo Use for lengthy text and numbers such as notes or descriptions.

You can use up to 63,999 characters.Number Use for data to be included in mathematical calculations, except

calculations involving money (Currency type).Date/Time Use for dates and times.Currency Use for currency values and to prevent rounding off during

calculations.AutoNumber Use for unique sequential (incrementing by 1) or random

numbers that are automatically generated when a record isadded.

Yes/No Use for data that can be only one of two possible values, suchas Yes/No, True/False, On/Off.

OLE Object Use for OLE objects (such as Microsoft Word documents, Excelspreadsheets, pictures, sounds or other binary data) that werecreated in other programmes, e.g. a photograph.

Hyperlink Use this if you want to include a hyperlink to another part of thedatabase or another document or a website.

Setting a Primary key 

The Student Number field is going to be what is called the Primary key. This is aunique identifier for each record in the database.

The Primary key is the one field in the database that cannot be duplicated. Peoplecan have the same first or second name, the same date of birth, even the sameaddress and phone number, but the Primary key is a unique identifier. UsingAutoNumber as the data type means that the same number cannot be allocated tomore than one person. Once a field has been designated as the Primary key Accesswill not let you enter the same data into two different records. Even if a record hasbeen deleted the Primary key could not be used again.

1. Click on the pale blue square to the left of the field description Student Number so that it is selected. You will know when it is selected because the row will besurrounded by an orange box.

2. Click on the Primary key button on the Command ribbon.

Page 8: 1.Introduction to Databases in Access 2007

8/6/2019 1.Introduction to Databases in Access 2007

http://slidepdf.com/reader/full/1introduction-to-databases-in-access-2007 8/12

8

You will know when a row has been designated as the Primary key because therewill be a small key symbol in the box.

Switching views 

In order to be able to enter data into the table you need to switch from Design viewto Datasheet view.

1. Click on the View button on the Command ribbon. You used this previously to

get into Design view.

2. From the drop-down menu select the option Datasheet view.

In future you can switch between Design View and Datasheet View using this button.You will always need to save what you have done before you can switch views.

Page 9: 1.Introduction to Databases in Access 2007

8/6/2019 1.Introduction to Databases in Access 2007

http://slidepdf.com/reader/full/1introduction-to-databases-in-access-2007 9/12

9

Entering data into the table 

1. At the moment the Student Number field is selected. You can tell because it ispartially black. You assigned this field the data type of AutoNumber, so you donot need to type anything into it because a number will be allocated

automatically. Press the Tab key or click on the next field.2. You are now in the First name field. Type the student’s first name in here,

“Charles” and press the Tab key to move to the next field.3. Enter the student’s second name, “Thornton” and press the Tab key.4. Enter the street address, “1 Applegate Street” and press the Tab key.5. Enter the town “Worthing” and press the Tab key.6. Enter the telephone number “01456 889965” and press the Tab key.7. Enter the date of birth “04/09/69” and press the Tab key.8. Enter the course “Travel and Tourism” and press the Tab key.

You have now entered a complete record and the AutoNumber field for the next

blank record is now selected.

You should notice two things:

this student has been allocated the AutoNumber of “1”

some of the field columns are too narrow for the entries in them

You can make the columns wider:

1. Position the mouse pointer over the line dividing the column designator for thecolumn that you want to make wider and the next column. Start by positioningthe mouse pointer over the line between the column designator for Streetaddress and Town. Do not click the mouse button.

2. The mouse pointer will turn into a two headed arrow crossing a black vertical line.When you see this symbol double-click the mouse button and the column shouldbecome wide enough to accommodate the data. You may need to repeat this

several times in the different columns while you are entering data.3. Repeat the process for the Course name column so that the words “Travel and

Tourism” will fit.4. You can also make a column narrower if the data does not fill it. This can be

useful if you are going to print out your table later so that you are not wastingspace. You know that the dates of birth will all be the same width so repeat step2 for the Date of birth column to make it narrower.

Enter the following records into the table and remember:

press the Tab key between each entry

do not type anything into the AutoNumber field

Page 10: 1.Introduction to Databases in Access 2007

8/6/2019 1.Introduction to Databases in Access 2007

http://slidepdf.com/reader/full/1introduction-to-databases-in-access-2007 10/12

10

Firstname

Secondname

Streetaddress

Town Telephonenumber

Date ofbirth

Course

Mina Patel 15SunnysideRoad

London 0107 8906543

05/06/78 MedicalImaging

Ade Ageyman 56 BostonRoad

Brighton 0987 65987 07/11/56 Early Years

Jane McDonald 23LansdownRoad

Southsea 023 6785490

12/12/87 MedicinesManagement

Waseem Khan 109 StHenryStreet

Portsmouth 023 9784123

11/08/43 EducationalAdministration

Martin Stevens 24 StJohn’sRoad

Ryde 01983654789

30/09/62 ParamedicScience

Make sure that all of the columns are wide enough for the entries. Your databasetable should look like this:

Save the database table by clicking on the Save button circled above on the QuickAccess toolbar.

Closing and re-opening the database 

Closing the database

Close the database by clicking on the Office button at the top left handcorner of the screen. Then select the Close Database option at thebottom of the list.

Page 11: 1.Introduction to Databases in Access 2007

8/6/2019 1.Introduction to Databases in Access 2007

http://slidepdf.com/reader/full/1introduction-to-databases-in-access-2007 11/12

Page 12: 1.Introduction to Databases in Access 2007

8/6/2019 1.Introduction to Databases in Access 2007

http://slidepdf.com/reader/full/1introduction-to-databases-in-access-2007 12/12

12

3. To open a database that has recently been used click on it in the list to the right-hand side of the screen. If the database that you want to openis not in that list click on the More icon at the top of the list.This will open your My Documents folder, search for the

database you want to open and open it as you would any other file.

OTHER TOPICS IN ACCESS 2007: 

Sorting a database table in Access 2007 Simple database queries in Access 2007 Multiple search queries and wildcards in Access 2007 Queries using relational/comparison operators in Access 2007 Using And and Or operators in Access 2007 

Producing reports based on queries in Access 2007 Adding a header or footer to a report in Access 2007 Constructing a query using more than one table