Information Technology               D01D 10

 

Using Databases

 

Databases are rather like electronic filing systems, used to store a wide range of different types of information. Electronic databases such as Microsoft Access have a number of advantages over traditional ‘paper’ filing systems:

 

 

 

Using databases – adding data with a form

 

An example of an Access database has already been created for you to look at.

 

Go to www.socialsciencestow.co.uk, click on IT & DTP, IT Int 1 (NQ Care). You should see a file called ‘Social Science database’ in the list of documents. Right click on this link and choose ‘save target as’. Save the file in your ‘S’ drive (the space that starts with your student ID number).

 

Now go to the start menu > programs > Microsoft Office > Microsoft Access. As this is another Microsoft program (like Word and Publisher), some of the menus are the same – e.g. file and open to open the file you have downloaded. Do this now.


You should now see a menu like the one below:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Click on ‘forms’ on the left hand side. Double click to open the form called ‘social science staff’, as shown below:

 

 

We will cover the creation and design of forms in future weeks – just now, we are going to enter some data. As you can see, there are five ‘fields’ – the tutor’s name, room number, role, telephone extension and email address.

 

At the bottom of the form, there are buttons telling you which record number you are on, and allowing you to move backwards and forwards. We will return to these once we have entered some data!

 


Enter the following information:

 

Tutor

Room

Role

Telephone Extension

Email

Pam Currie

220

Lecturer

334

pcurrie@stow.ac.uk

Charlie Montgomery

220

Lecturer

335

cmontgomery@stow.ac.uk

Jill McInnes

220

Lecturer

335

jmcinnes@stow.ac.uk

Rab Wilson

333

Senior Lecturer

332

rwilson@stow.ac.uk

 

You can move between fields by pressing the ‘tab’ button (above caps lock) or by clicking with the mouse – you will probably find the tab button is quicker and easier. If you make a mistake, go back with the mouse and highlight the text to change it, as in Word.

 

When you have finished adding the text provided, use the arrow buttons at the bottom of the form to go back to Pam Currie (record 1). Change Pam’s telephone extension to 335.

 

Now use the >* button to create a new record at the end, and add the following information:

 

Tutor

Room

Role

Telephone Extension

Email

Christine Hughes

220

Lecturer and Guidance Tutor

335

chughes@stow.ac.uk

 

When you have finished, close the form using the red X. The form will save automatically.

 

Using tables to add and edit data

 

Forms are useful for adding new records to an existing database, but sometimes it is easier to edit records when we can see all of the records at the same time.

 

To do this, click on tables in the left hand side of the menu. Click on ‘social science staff’. You should now see the information you entered before, but in a table format.

 

Use your mouse to select Rab Wilson’s room number in the table. Change the room number to 322, print out your table, check it for spelling errors or mistakes, and then show it to your tutor.


Creating a database

 

So far, so good. Now, we’re going to look at how you can create your own simple database.

 

Open Microsoft Access if you do not already have it open, and go to file > new. A series of options will appear on the right hand side of the screen – choose the first one – blank database.

 

The first thing you will be asked to do is to save your database. Call it ‘my database’ and save it in your ‘S’ drive.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Choose the first option – ‘create table in Design view’ – as shown above.

 


You will see a screen like the one below:

 

 

In the first field name, type ‘name’. Now press tab. You will see that the ‘data type’ box automatically says ‘text’.

 

 

If you look lower down the screen, you will see that information has appeared in the ‘general’ box. ‘Field size: 50’ means that this field can have a maximum of 50 characters. As it’s highly unlikely that anyone would have a name of more than 50 letters, we won’t need to change this.

 


Now go down to the next line and enter ‘age’ as the field name. This time, instead of text, we want a number, so click on the blue down arrow next to this field to change it:

 

 

Choose number from the list. Under ‘general’, the field size now says ‘integer’ – this is a number of any length. We will be using data from the students in the class, so unless you suspect that any of your colleagues are under 10 or over 100, we can change this to ‘double’.

 

 

Continue adding the following fields:

 

Career ambition (text)

Favourite band (text)

Favourite colour (text).

 

 

When you have finished, click on the red X to close the table. It will prompt you to save the table – click ‘yes’ and name the table ‘my table’. You will then be prompted to set a primary key – click ‘yes’ again.

 

Gathering and entering data

 

Before we enter the data, we will first need to gather it! Find out the following information from at least 3 of your colleagues (you can lie about your age provided it has two digits!!!):

 

 

Student #1

Student #2

Student #3

Name

 

 

 

Age

 

 

 

Career Ambition

 

 

 

Favourite Band

 

 

 

Favourite Colour

 

 

 

 

 

 

Now enter the data you gathered, by clicking on ‘my table’. You should see a table as below:

 

 

 

Add text by clicking in the first ‘name’ space and entering the person’s name. Use the tab button to move from one field to another. When you get to the end of the first line, use tab to automatically move on to the next record.

 

To make your columns bigger in order to see all the text, hover the mouse at the edge of the grey cell at the top of the column. Your cursor will change into a black arrow and you can move the column to the left or right. The other columns will automatically move along to make space. Try this now.

 

When you have entered all of your text, check for mistakes before printing out your record. Close the table to save it.