Sie sind auf Seite 1von 7

F -X C h a n ge F -X C h a n ge

PD PD
1/5/2010 Develop Business applications with Micr…

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

Previous Contents Next

Lesson 3 for Tuesday, January 05, 2010

Creating the database

For more information and special deals


related to any of the issues on this page,
plac e your cursor over the double-underlined
links.
All information supplied by Kontera.c om.

The new "MikeVideo" database

To your keyboards. START ACCESS!

Do you want to open an existing database or create a new one. If this is your first session, you want to create
a new database.

And, because you want to learn something from the ground up, you won't use the wizards, pages and projects
which are the database-creation templates.

Onc e you've mastered the c onc ept, then you c an use the shortcuts and let Access guide you through the
proc ess.

www.profsr.com/access/accless03.htm 1/7
F -X C h a n ge F -X C h a n ge
PD PD
1/5/2010 Develop Business applications with Micr…

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

And again, to make it interesting, just c hoose General Database.

Choose a name for the database and store it in a folder.

In Access, a database, no matter how many tables or forms or reports it contains, is stored in a
single file. That file has the extension: .mdb (for Mic rosoft database). When you want to move or
c opy or delete the database, all you have to do is work with the one file.

www.profsr.com/access/accless03.htm 2/7
F -X C h a n ge F -X C h a n ge
PD PD
1/5/2010 Develop Business applications with Micr…

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k
So far, you have an empty database.

The first object you create to define the database is the table.

A table is the desc ription of an entity. It is used to store the data. When you create the table you
first desc ribe its structure.

A table in Access is sort of like a spreadsheet in Exc el: it consists of rows and c olumns. Only, it is
more organized than a spreadsheet and that organization will later allow you to retrieve the data in
all kinds of ways.

The design view of the table is meant to define the structure.

You name all the columns (in technical jargon they would be called attributes of the entity).
Remember to use the prefix for the table, in this case c_ because it's the Customers table.

www.profsr.com/access/accless03.htm 3/7
F -X C h a n ge F -X C h a n ge
PD PD
1/5/2010 Develop Business applications with Micr…

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

Then, choose a Data Type for each column.

The Data Type defines what kind of data will be c ontained: text, numbers, URL, dates, etc. This
lets the system know how much memory to reserve and also, what you are allowed to do to the
data. For example, if you specify that a column is a "Number" type, you won't be allowed to put
"XYZ" in it.

To see the data types available, c lick on the Data Type column and do F1 (the Help function).
Here's what you should get:

www.profsr.com/access/accless03.htm 4/7
F -X C h a n ge F -X C h a n ge
PD PD
1/5/2010 Develop Business applications with Micr…

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

www.profsr.com/access/accless03.htm 5/7
F -X C h a n ge F -X C h a n ge
PD PD
1/5/2010 Develop Business applications with Micr…

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
And here are the basic rules on how to use them:
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

When you define a primary key field and it doesn't matter what the format is, use
AutoNumber. If the identifier is formatted, like A9-1234, use Text.

When the data is a date of any kind, Date of birth, Date hired, Invoic e date, etc ., you have
to use the Date/Time data type.

Most fields will be Text. Even a phone number (it c ontains a dash), or department number
that happens to be 101.

Use Number only for fields that will be used in calc ulations (+ - * / ) like quantities or
salaries. If it does not have to be calculated, use Text. Even if the Department_number is
101, define it as text: it's not the number one hundred and one, it's the c haracters "1""0""1".
Believe me, it will make your life easier.

Use Memo when the Text field may be too big. If you are doing a Patients table for a
Doc tor, the Diagnosis field should be Memo.

Whenever a field has only a yes/no answer, use the Yes/No type. For example: Paid?,
Member?, Ac tive?

Before starting to enter data, you should


define the data formats in the Windows
Control Panel.

Ac cess gets its formatting information from


Windows.

If you want dates to automatically display


as YYYY-MM-DD, as you should, you set
that property in Windows.

The same for currency and number


formats. Different countries have different
ways of displaying those types so, you set
them for your country in the Windows
environment.

The Properties at the bottom will usually be acc eptable for the data type you selec ted.

But, to simplify things later there is one property you should indicate: Caption.

The Caption is the name that will show for the column on forms and reports and so on. If there is
no caption, the Field Name is used. So, if you want forms to show "Customer ID" instead of
c _custID, define the c aption.

Now, complete the Table, as defined in the model from Lesson 2, adding all the fields required.

Before you save the Table, make sure the Primary key is identified. To do that, clic k on the grey
button to the left of c_CustID and that should selec t the whole row. Then click on the key in the
toolbar. That should put a little key symbol on the grey button, identifying that field as the
Primary key.

www.profsr.com/access/accless03.htm 6/7
F -X C h a n ge F -X C h a n ge
PD PD
1/5/2010 Develop Business applications with Micr…

!
W

W
O

O
Save the table and, if this is the first Save, it will ask you to name it (don't keep Table1 as a
N

N
y

y
bu

bu
name!).
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

Finally, repeat the whole process with the Movies table and you will be well on your way.

Next week: Linking Tables together through Relationships. See you then!

Top

Home | Tutorials | Contact | Sitemap | Add URL | Privacy policy

www.profsr.com/access/accless03.htm 7/7

Das könnte Ihnen auch gefallen