Introduction to Health Informatics

Introduction to Health Informatics
Introduction to Access97 (1):
Tables & Fields
by Robin Beaumont
e-mail: robin@robinbt2.free-online.co.uk
1.
Learning outcomes check list for the session ................................................................................... 2
2.
Introduction............................................................................................................................................ 3
3.
The consultations database ................................................................................................................. 3
4.
Starting Access ..................................................................................................................................... 4
5.
Getting help when in Access................................................................................................................ 4
6.
How to create a Database in ACCESS ................................................................................................. 6
7.
How to create a new table and fields in ACCESS............................................................................... 7
7.1
Adding fields ...................................................................................................................... 8
7.2
Saving your work ............................................................................................................... 9
7.3
Input masks ..................................................................................................................... 11
7.4
Moving between design and datasheet view ................................................................... 12
8.
Working with records in datasheet view ........................................................................................... 13
8.1
9.
Deleting records............................................................................................................... 14
Inserting / deleting or moving field definitions................................................................................. 14
10.
Required field values ...................................................................................................................... 15
11.
Creating Key Fields in Access ....................................................................................................... 16
11.1
11.2
12.
Setting a Primary Key ...................................................................................................... 16
Removing a primary key .................................................................................................. 16
Closing an existing database ......................................................................................................... 17
Opening an existing database.................................................................................................................... 17
14.
Consultations Exercise (creating the Con1 database)................................................................. 18
15.
Resumé............................................................................................................................................. 20
16.
Check what you have learnt ........................................................................................................... 20
17.
Renaming or copying tables........................................................................................................... 21
18.
References ....................................................................................................................................... 21
19.
Answers to exercises...................................................................................................................... 21
This handout is part of a course. For details of other material that
should be read before this please see Section 7.1 at:
http://robinbt2.free-online.co.uk/virtualclassroom/contents.htm
Introduction to Health Informatics
Access97 (1) - Tables and Fields
1. Learning outcomes check list for the session
This practical sessions aims to provide you with a number of skills (the 'be able to's') along with relevant
information (the 'know what's'). These are listed below. After you have completed the session you should
come back to these points ticking off those you feel happy with.
Learning outcome
Tick
box
Be able to open up, and close down Access.
‰
Be able to use the help system in Access.
‰
Know what a table, form, query and report are along
with their uses.
‰
Be able to create a new Access database or open an
existing one
‰
Be able to create tables and fields
‰
Be able to save your database onto a floppy disc
‰
Know how to rename or copy tables
‰
Know what 'input masks' are and why they are used.
‰
Be able to create 'input masks'
‰
Know the difference between design and datasheet
views.
‰
Be able to move between design and datasheet
views.
‰
Be able to view, edit, insert or delete records.
‰
Be able to create fields that require a value in them
('non null')
‰
Be able to create a primary key
‰
Know how to delete a primary key
‰
The exercise you will work through focuses on creating a database to collect data about consultations.
Robin Beaumont 29/03/00 Tel:0191 2731150 e-mail: robin@robinbt2.free-online.co.uk Source: Laptop; C:\HIcourseweb new\chap8\s1\ACCESS1ver7.DOC
Page 2
Introduction to Health Informatics
Access97 (1) - Tables and Fields
2. Introduction
Access is fast becoming the most popular database for small projects. It is also often used to prototype
things that will eventually be developed in a more robust environment. Yes Access has bugs in it, in-fact a
large number! Much more expensive DBMSs (DataBase Management Systems) such as ORACLE are
far more bug free but much more difficult to use. You know you can trust your data in ORACLE. We will
therefore introduce you to databases in a relatively gentle manner.
3. The consultations database
During this session we will begin to develop a ‘consultation’ database which is designed to allow doctors
the ability to collect information about various aspects of their patients and consultations. The database
consists of a number of tables one of which defines the data required from patients. The data dictionary
for the 'patient' table is given below. If you are unsure what a Data dictionary is see 'ways f thinking about
the clinical information you collect - Data' from the main web site (http://wwwrobinbt2.freeonline.co.uk/virtualclassroom/contents.htm). The patient table will be the first table you will create in
ACCESS97 during this session.
Patient Table details
Field number
Field Name
Field type
Field size
Description
1
Patient id
number
long
integer
The unique patient
identifier
2
Title
text
15
Mr, Miss, Ms, Dr or Prof.
3
First Name
Text
15
First name of patient
4
Surname
Text
15
Surname of patient
5
Doc ID
Number
long
integer
Doctor ID
6
DOB
date /time
Short date
date of birth
7
Gender
Number
Integer
Male / female etc.
8
Date on list
date /time
Short date
Date put on list
9
No children
Number
Integer
Number of children
10
Addrs title
Text
20
Name of house
11
Addrs st
name
Text
20
Name of st
12
Addrs st no
Text
20
Number of st. Note
could be 2a etc.
13
city
Text
10
Name of city
14
PostcodeA
Text
4
First part of post code
15
PostcodeB
Text
4
Second part of post
code
(for reference
only)
Robin Beaumont 29/03/00 Tel:0191 2731150 e-mail: robin@robinbt2.free-online.co.uk Source: Laptop; C:\HIcourseweb new\chap8\s1\ACCESS1ver7.DOC
Page 3
Introduction to Health Informatics
Access97 (1) - Tables and Fields
4. Starting Access
Exercise:
Call up Access by clicking the left mouse button on the relevant icon on the screen (i.e. the
desktop).
5. Getting help when in Access
The easiest way to find out about Access is to view the Help -> Contents and Index. This provides the
index to the help system, but unfortunately, this often gets you into hidden depths without giving you the
basic information you were originally looking for! The following exercise gives you a starting point.
Exercise:
First you need to close the initial window that appears when
you open Access. Do this by clicking on the Cancel button.
From the Access main window choose the menu
option help -> Contents and Index.
Find the topic ‘Introduction to Microsoft Access 97’.
Double click it to expand the options to give you what is
shown opposite:
Robin Beaumont 29/03/00 Tel:0191 2731150 e-mail: robin@robinbt2.free-online.co.uk Source: Laptop; C:\HIcourseweb new\chap8\s1\ACCESS1ver7.DOC
Page 4
Introduction to Health Informatics
Access97 (1) - Tables and Fields
Click on the option, Databases: What they are and how they work. Then click the display button.
You will now be presented with the
first of 7 screens of information.
You can move between the
screens by clicking on the numbers
in the top left hand of the window.
To return to the screen from which
you came click the Help Topics
button at the top left hand part of
the window.
When you have had enough move back to the help
contents window, shown below. Now choose the
option tables
Read through the following topics:
•
Tables
•
Forms
•
Queries
•
Reports
Then close the help window.
Another way of obtaining help is to use the Office
assistant that is part of help. This has replaced the
clue cards found in earlier versions. You get to the Office assistant by choosing the menu option Help →
Microsoft Office Help.
Using Access97 help Exercise:
Once you have read the help screens suggested above answer the following. Feel free to go back around
again if you need to.
1.
2.
3.
4.
5.
6.
What are the four main objects or things in Access?
What are the two views that Access offers for tables?
Reports can be created from two sources of data. What are they?
Queries produce two type of results. What are they?
What is the main difference between the two types of datasets produced from a query?
Forms allow you to create colourful screens to edit data in your database. What are the two standard
sources of data for a form?
7. What are the two types of view for a form?
Answers are given at the back of this handout.
Robin Beaumont 29/03/00 Tel:0191 2731150 e-mail: robin@robinbt2.free-online.co.uk Source: Laptop; C:\HIcourseweb new\chap8\s1\ACCESS1ver7.DOC
Page 5
Introduction to Health Informatics
Access97 (1) - Tables and Fields
6. How to create a Database in ACCESS
Key point:
The exercises in this session are based on developing a consultations database to collect data
about consultations from a doctors perspective.
If you are not in Access call it up by choosing the relevant icon or menu option. Once Access has been
called up you will be presented with the
following screen:
Choose the option Blank Database.
Alternatively if you do not have this
window displayed choose the menu
option File -> New Database. Then
click the OK button.
Another dialogue box with the title
’File new database’ now appears.
Ensure you have a formatted floppy disk in the external disk drive.
Make sure you have changed
the drives option to A: either by
typing it in or choosing from the
drop down list box presented
when you click the down arrow
beside it.
Type in the filename box:
Cons1. This is short, in my
mind for, consultations database
attempt one.
NB there is no need for the full stop.
Click the Create button.
Access will now allow you to begin to set up your database called cons1 on your floppy disc. Notice that
the message 'verifying system objects' appears momentarily at the bottom left hand corner of the screen
(the status bar), This is often a good place to look for hints as to what's going on. All this message means
is that the computer is creating and saving a load of information about the database you have just created
which is called meta-data (the DBMS keeps its own record of tables, fields or the number of records in
each table etc.). You can check this information periodically by choosing the menu option File ->
Database Properties.
Robin Beaumont 29/03/00 Tel:0191 2731150 e-mail: robin@robinbt2.free-online.co.uk Source: Laptop; C:\HIcourseweb new\chap8\s1\ACCESS1ver7.DOC
Page 6
Introduction to Health Informatics
Access97 (1) - Tables and Fields
7. How to create a new table and fields in ACCESS
Once you have created a database you can start to create the tables. Unfortunately, you can't give a table
a name in Access until you have added one or more fields to it. We will therefore first add a field then
subsequently give the table a name in the exercise below.
You should have the database window displayed now (see below). This window provides an overview of
your database. The options along the top, called tabs (table, query, from etc.) allow you to inspect the
tables, forms and queries etc.
associated with the database at your
leisure. At present your database is
empty but by the end of the session
you will have several tables.
Exercise:
Make sure the tables tab is chosen
i.e. highlighted
Click the New button.
You will now be presented with the
following dialogue box:
The Table Wizards option in the
dialogue box allows you to choose
from a set of tables that have already
been designed by Microsoft (the
makers of Access). However at the
moment we will develop ours from
scratch rather than borrow.
Exercise:
Select the 'Design View' option from the list (illustrated above) then click on the OK button.
The main screen for specifying the structure of a table now appears - at last. Note that the example on
the next page has some details in it whereas your dialogue will be blank.
Robin Beaumont 29/03/00 Tel:0191 2731150 e-mail: robin@robinbt2.free-online.co.uk Source: Laptop; C:\HIcourseweb new\chap8\s1\ACCESS1ver7.DOC
Page 7
Introduction to Health Informatics
Access97 (1) - Tables and Fields
Top pane = Field list
Bottom
pane
=
properties for each field
Press F6 to move
between them or use the
mouse.
Tells you what’s going on
7.1 Adding fields
I have typed in the description for the first field in the above picture of the screen (screen shot). Follow the
instructions below to achieve the same result:
Exercise:
Type in the Field name Patient id.
Move to the data type column a down arrow appears. Click on it and a drop down selection list
appears, choose the number type.
There are several types of numbers in Access. To indicate which one you intend to use move
to the bottom half (pane) of the dialogue box. Do this by pressing F6 (notice the status bar, at
the bottom of the screen gave you that information).
You should now have the field size field highlighted, again click the down arrow to choose the
long integer type. The picture below illustrates this step:
Robin Beaumont 29/03/00 Tel:0191 2731150 e-mail: robin@robinbt2.free-online.co.uk Source: Laptop; C:\HIcourseweb new\chap8\s1\ACCESS1ver7.DOC
Page 8
Introduction to Health Informatics
Access97 (1) - Tables and Fields
You should have noticed several things when moving between the panels. The most important is that the
information given in the right hand side of the bottom panel has changed to reflect the field you have
currently highlighted. Its a bit like offering you automatic help.
Now add the description The unique patient identifier in the description column.
7.2 Saving your work
This is one of the most important things to remember to do constantly.
Exercise:
Save your work now by choosing the main menu option File → Save or click on the appropriate
speed button on the tool bar. To find out which speed button it is just leave the mouse cursor
resting over each in turn. You will notice that after a few seconds a little text box appears
giving you details.
When you attempt to save your work you will be prompted to give the table a name.
Give this table the name Patient. (Note no full stop or quote marks are needed)
A warning box will appear asking if you want a primary key choose the 'No' button. We will
create one manually latter.
Another important thing you should learn is how to make backups of your work. Often discs fail, not only
the floppy ones you carry around with you but also the, hard discs, found in machines. If you are doing
something important:
ALWAYS KEEP THREE CURRENT BACKUPS OF YOUR WORK.
Robin Beaumont 29/03/00 Tel:0191 2731150 e-mail: robin@robinbt2.free-online.co.uk Source: Laptop; C:\HIcourseweb new\chap8\s1\ACCESS1ver7.DOC
Page 9
Introduction to Health Informatics
Access97 (1) - Tables and Fields
Exercise:
Now please add the following fields to the patient table:
After adding each field save your work
Patient Table details
Field number
Field Name
Field type
Field size
Description
2
Title
text
15
Mr, Miss, Ms, Dr or Prof.
3
First Name
Text
15
First name of patient
4
Surname
Text
15
Surname of patient
5
Doc ID
Number
long
integer
Doctor ID
6
DOB
date /time
Short date
date of birth
7
Gender
Number
Integer
Male / female etc.
8
Date on list
date /time
Short date
Date put on list
9
No children
Number
Integer
Number of children
10
Addrs title
Text
20
Name of house
11
Addrs st
name
Text
20
Name of st
12
Addrs st no
Text
20
Number of st. Note could be 2a
etc.
13
city
Text
10
Name of city
14
PostcodeA
Text
4
First part of post code
15
PostcodeB
Text
4
Second part of post code
(for reference
only)
The first column 'field number' is just to help you keep tack of where your up to.
Make sure you have saved your work
You should now have 15 rows of field descriptions. In other words you have just created a table that has
15 fields. Congratulations you have just created your first database and table.
Robin Beaumont 29/03/00 Tel:0191 2731150 e-mail: robin@robinbt2.free-online.co.uk Source: Laptop; C:\HIcourseweb new\chap8\s1\ACCESS1ver7.DOC
Page 10
Introduction to Health Informatics
Access97 (1) - Tables and Fields
You should have noticed that the data dictionary presented at the beginning of this section and again
above has been used to create the table in ACCESS.
Key point:
The data dictionary forms the basis for the tables in ACCESS97
7.3 Input masks
One of the main bug bears of databases is the amount of crap data in them. One small thing you can do
to help is make sure users are encouraged to enter only sensible data. Two common ways to do this is to
allow them only the opportunity to enter data from a predefined list of options from a 'list box' of some type
or create a 'input mask'. We will create an input mask in this session.
The Input Mask property setting specifies how data is entered and displayed in the text box. We will set
this property for the DOB field you created in the last exercise to stop users entering duff dates of birth.
Exercise:
Select the DOB field by clicking on one of its cells or the left hand edge (get back to the field
description dialogue box we have been working in if necessary
Move to the bottom panel by mouse clicking or pressing F6.
Move to the Input Mask property in the bottom panel.
Click on the button beside it (the one with the
three dots; it is called a build button as it
provides instructions on how to build, in this
instance, the mask). You will be presented
with the input mask wizard dialogue box
pictured below:
If the short date (not the short time) is not
already chosen choose it then click next.
Accept all the defaults until you come to the
screen where the next button is greyed (you
can't choose it) and click the finish button.
Save your work by choosing the main menu
option File → Save or click on the appropriate speed button on the tool bar.
The above process adds the 'Pattern' "99/99/00;0;_" to the input mask property of the field. Each of these
characters has a special meaning, which if you had known, you could have added without using the
wizard. To find out what this has done exactly you need to try it out by moving from design view to data
sheet view. This is described below. But first please carry out the following exercise.
Exercise:
Repeat what you have just done to the DOB field to the 'date on list' field.
Save your work by choosing the main menu option File → Save or click on the appropriate
speed button on the tool bar.
Robin Beaumont 29/03/00 Tel:0191 2731150 e-mail: robin@robinbt2.free-online.co.uk Source: Laptop; C:\HIcourseweb new\chap8\s1\ACCESS1ver7.DOC
Page 11
Introduction to Health Informatics
Access97 (1) - Tables and Fields
7.4 Moving between design and datasheet view
Datasheet view allows you to try out the table you have designed. You can add, edit, search and delete
records in datasheet view. Datasheet view is not really designed for you to change the structure of the
table which is best done in design view.
To move between datasheet and design view you:
Choose the menu options View → Design view or View → datasheet view alternatively use the following
speed button:
Exercise:
Move to datasheet view. You should now have something like this on your screen. Think of is
as a spreadsheet with each row representing a single record, and the columns the fields.
The darkened arrow near the top left hand corner indicates the current selected record. As we haven't
added any to the table yet it is at record 1 of 1 look at the bottom of the window.
Exercise:
Click on the DOB field and notice what happens. Try typing in the invalid date 23/23/89. What
happens?
Click the OK button to get rid of the error message.
Now delete the value by pressing the Esc key as you won't be able to move out of the cell until
you do so!
Key point: Pressing the Esc key cancels any changes you may have made to a field.
Robin Beaumont 29/03/00 Tel:0191 2731150 e-mail: robin@robinbt2.free-online.co.uk Source: Laptop; C:\HIcourseweb new\chap8\s1\ACCESS1ver7.DOC
Page 12
Introduction to Health Informatics
Access97 (1) - Tables and Fields
8. Working with records in datasheet view
If you have ever used a spreadsheet working in datasheet view it is pretty much the same with one
additional rule to remember. The data you see on the screen is not actually saved to the database until
you move off the particular record your working with.
Database
Screen display
(Permanent)
(Temporary)
User
Only when you move off the
record or choose save record or
table from the menu
Key point:
To add a record to the actual database and not just the screen you need to move off the record
you have been working on. This is achieved by either pressing the return key or clicking on
another cell above or below the record with the mouse or arrow keys.
Adding records Exercise:
Add the following two records to the patients table. Remember to move off the record to save it
or choose the menu option File -> 'save record'
Field name:
ID
1
2
Title
Mr
Miss
First name
John
Sheila
Surname
Smith
Jones
Doc ID
100
32
DOC
01/01/68
02/01/55
You should now have something similar to the picture below:
Robin Beaumont 29/03/00 Tel:0191 2731150 e-mail: robin@robinbt2.free-online.co.uk Source: Laptop; C:\HIcourseweb new\chap8\s1\ACCESS1ver7.DOC
Page 13
Introduction to Health Informatics
Access97 (1) - Tables and Fields
8.1 Deleting records
Exercise demonstrating how to delete a record:
Make sure you are in datasheet view
Choose one of the fields in the record you want to delete. For this exercise you are going to
delete record 2, Miss Sheila Jones that is the second record in the two pictured above.
Therefore make sure the cursor is in one of the fields for her record.
Menu option Edit -> delete record
You will then be presented with a warning message, click the 'Yes' button.
Now save the changes by choosing the 'save table' menu item.
Note: There is an alternative shortcut to deleting a record, highlight the entire record by clicking
on the left hand side of the table and pressing the delete key. You can also select several
adjacent records using this method.
9. Inserting / deleting or moving field definitions
This is for reference only:
Insert row
(field)
Delete row
(field)
You can insert or delete field definitions (rows in the table design window) by clicking on the above speed
buttons.
To move a field definition (row) you simply click on it and drag it, or copy and paste it. If you use the Copy
and paste method you must rename the copy or delete the original. If you don’t you will get an error
message when you try to save the table. This is because all fields in a table must have unique names.
Also field names can only consist of what are called legal characters these are almost anything, except a
period (.), an exclamation mark (!), a backquote character (`), and brackets ([ ]). To find out more look in
the Access help under the entry for standard naming conventions.
Key point: Fields in a particular table must be uniquely named and the name must consist of
legal characters.
Robin Beaumont 29/03/00 Tel:0191 2731150 e-mail: robin@robinbt2.free-online.co.uk Source: Laptop; C:\HIcourseweb new\chap8\s1\ACCESS1ver7.DOC
Page 14
Introduction to Health Informatics
Access97 (1) - Tables and Fields
10. Required field values
A particular field in a record may be left blank. If that is the case the DBMS inserts an unseen value into it
called a Null. Often it is sensible to ensure that people are forced to enter a value in a particular field.
This can be achieved many ways but the most common is to set the required property of the field to yes.
Adding the required value option to a field Exercise:
Make sure you are in design view.
Set the required property of the Patient ID field to yes.
Now save your work by choosing the main menu option File → Save or click on the appropriate
speed button on the tool bar.
A error box will appear stating 'Data integrity rules have been changed' ….etc. Click the 'yes'
button.
Save your changes.
Robin Beaumont 29/03/00 Tel:0191 2731150 e-mail: robin@robinbt2.free-online.co.uk Source: Laptop; C:\HIcourseweb new\chap8\s1\ACCESS1ver7.DOC
Page 15
Introduction to Health Informatics
Access97 (1) - Tables and Fields
11. Creating Key Fields in Access
The ‘database theory’ handout describes what a key field is. Basically a key is a field, or a combination of
them, which possess a unique value for each record in a particular table. In this session we will create the
most important type of key, a Primary key. Remember a primary key is something that uniquely identifies
a record such as a bank account or driving licence number.
11.1 Setting a Primary Key
You can do this by firstly selecting the field(s) you want to make the primary key then choosing the menu
option Edit → set primary key or use the speed button with the picture of the key on it.
We now need to set the primary key for the Patient table:
Exercise:
Make sure you are in the design view of the patient table. The design speed button should
appear depressed along the toolbar.
Select the Patient ID field
Choose the menu option Edit → primary key or use the speed button with the key on it.
A little key sign should appear beside the field details.
Now save your work by choosing the main menu option File → save or
Click on the appropriate speed button on the tool bar.
11.2 Removing a primary key
The following is for reference only:
Made sure you have the table design window open and selected. You do not need to select any particular
field.
Menu option View → Indexes. Then remove whichever ones you want to by selecting the required rows.
Robin Beaumont 29/03/00 Tel:0191 2731150 e-mail: robin@robinbt2.free-online.co.uk Source: Laptop; C:\HIcourseweb new\chap8\s1\ACCESS1ver7.DOC
Page 16
Introduction to Health Informatics
Access97 (1) - Tables and Fields
12. Closing an existing database
The final two tasks for this session will be to close and open an existing database. That is the one you
have been working on.
Be fore closing a database you shouls always save any changes you have made first and then click the
close symbol on the window that you have been working in. You will eventually end up with the Database
window, that is the one providing a description of what the current database contains in terms of tables,
forms etc. Section 7 has a picture of the window. Then from the main access window choose File → close
database. You should now have a relatively empty window on your screen. To close down Access you
simply choose the menu option File → exit or click the close symbol on the window.
Exercise:
Close the cons1 database you have been working on BUT make sure you have saved your
work first!
Close down Access.
13. Opening an existing database
To open an existing database you first open up Access. See section 1.4.
Choose the Open Existing Database option from the ‘Microsoft Access’ window. Section 1.6 gives a
picture of it. You can either then choose from the list of databases or choose the ‘More files…’ option to
give you the standard open dialogue box shown below. Set the drive and filename to the one you want.
Make sure you choose the appropriate 'look in' folder (i.e. A: if you are working from the floppy
disk).
Robin Beaumont 29/03/00 Tel:0191 2731150 e-mail: robin@robinbt2.free-online.co.uk Source: Laptop; C:\HIcourseweb new\chap8\s1\ACCESS1ver7.DOC
Page 17
Introduction to Health Informatics
Access97 (1) - Tables and Fields
14. Consultations Exercise (creating the Con1 database)
So far we have only created one table containing data relating to patients yet the database is meant to
provide consultation details. We therefore also need to collect data about the doctor, the actual
consultation (which we will call an episode) and details of any possible diagnosis (we have assumed a
maximum of four in the exercise). The exercise below asks you to add these tables. We will discuss how
we came about dividing the data up into these tables in the part of the course concerned with object
modelling latter on just please accept it for now.
Exercise:
Please create the following tables and indexes to develop the cons1 database so that it will,
when you have finished, consist of 6 tables.
Notes:
An asterisk (*) after one or more field names in a table indicates that it is the Primary key of the
table.
Remember to make key fields have the non-null property.
Remember to save your work regularly.
Table Name: Doctor
Field number
(for reference
only)
Field Name
Field type
Field size
Description
1
Doc ID*
Number
Long Integer
Unique ID for doctor
2
Doc first name
text
15
First name of doctor
3
Doc Surname
text
15
Surname of doctor
4
Gender
Number
Integer
Male / female etc.
5
Date reg
date
Short date
Date qualified
6
Addrs title
Text
20
name of house/practice
7
Addrs st name
Text
20
name of st
8
Addrs st no
Text
20
number of st. Note could
be 2a etc.
9
city
Text
10
name of city
10
PostcodeA
Text
4
first part of post code
11
PostcodeB
Text
4
second part of post code
12
Phone No.
Text
15
Note: Need to decide
formatting
Robin Beaumont 29/03/00 Tel:0191 2731150 e-mail: robin@robinbt2.free-online.co.uk Source: Laptop; C:\HIcourseweb new\chap8\s1\ACCESS1ver7.DOC
Page 18
Introduction to Health Informatics
Access97 (1) - Tables and Fields
Table Name: Episode
Field number
Field Name
Field type
Field size
Description
1
Episode ID*
Number
Long Integer
Unique ID for episode
2
Patient ID
Number
Long Integer
3
Doc ID
Number
Long Integer
4
Date Seen
date
Short date
Date seen
5
Urgency
yes/no
n/a
Whether they were an
emergency or not
6
Systolic
Number
integer
7
Diastolic
Number
integer
(for reference
only)
The next three tables provide information about diagnosis. Notice the compound keys:
Table Name: PRIM_D
Field number
Field Name
Field type
Field
size
Description
1
Episode ID*
Number
Long
Integer
Episode this relates to
2
Primary*
Text
20
primary diagnosis
Field Name
Field type
Field
size
Description
1
Episode ID*
Number
Long
Integer
Episode this relates to
2
Secondary*
Text
20
secondary diagnosis
(for reference
only)
Table Name: SEC_D
Field number
(for reference
only)
Robin Beaumont 29/03/00 Tel:0191 2731150 e-mail: robin@robinbt2.free-online.co.uk Source: Laptop; C:\HIcourseweb new\chap8\s1\ACCESS1ver7.DOC
Page 19
Introduction to Health Informatics
Access97 (1) - Tables and Fields
Table Name: OTHER_D
Field number
Field Name
Field type
Field
size
Comments
1
Episode ID*
Number
Long
Integer
Episode this relates to
2
Other*
Text
20
Any other diagnosis
(for reference
only)
Make sure you have saved your work.
During the next session we will be linking these tables together, and creating several nice input screens
that are easier to use than the datasheet view of the table.
15. Resumé
You have now learnt the basics of constructing tables and fields. You have also learnt how to set a variety
of characteristics for fields including, input masks, required values as well as the very important process of
setting up primary keys.
16. Check what you have learnt
Now go back to the beginning of the material for the session and read through the 'Learning outcomes
check list' for the session. How many can you tick? If you are not sure about any particular ones go back
through the exercise. If you are still unsure please contact me.
Robin Beaumont 29/03/00 Tel:0191 2731150 e-mail: robin@robinbt2.free-online.co.uk Source: Laptop; C:\HIcourseweb new\chap8\s1\ACCESS1ver7.DOC
Page 20
Introduction to Health Informatics
Access97 (1) - Tables and Fields
17. Renaming or copying tables
The details are given below for reference:
You can rename a table when the database window is displayed and selected along with a table name.
The database window has been shown at the beginning of the section 'How to create a new table and
fields in Access' You choose the main menu option File → Rename. You will then be prompted for a new
name.
You can copy a table, from the currently open database when the database window is displayed and
selected along with a table name. Choose the main menu option edit → copy. Then the main menu
option Edit → Paste You will then be prompted for details as to what exactly you want to copy either the
structure and / or the records. See the diagram at beginning of 'How to create a new table and fields in
Access' section to find out what the 'database window' is. You can also import a table from another
database by right mouse clicking when the tables tab is selected and choosing the import menu item.
18. References
Access online help.
Access manuals.
Reingruber Michael C. Gregory William W 1994 The Data Modeling Handbook John Wiley & Sons.
Chichester.
19. Answers to exercises
These are the answers to the exercises on page 6.
1
2
3
4
5
6
7
Tables, Queries, Forms and Reports.
Design and datasheet (working and design model.
Tables and Queries.
Dynasets and snapshots.
Dynasets you can edit. Snapshots you can’t edit.
Table or Query.
Design and form view (working and design mode).
Document info:
Robin Beaumont 29/03/00 Tel:0191 2731150 e-mail: robin@robinbt2.free-online.co.uk
Source: Laptop; C:\HIcourseweb new\chap8\s1\ACCESS1ver7.DOC
Date: 29/03/2000 16:54
Robin Beaumont 29/03/00 Tel:0191 2731150 e-mail: robin@robinbt2.free-online.co.uk Source: Laptop; C:\HIcourseweb new\chap8\s1\ACCESS1ver7.DOC
Page 21
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertising