0% found this document useful (0 votes)
11 views9 pages

Microsoft Access 2

Uploaded by

Muhammad Luthfi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views9 pages

Microsoft Access 2

Uploaded by

Muhammad Luthfi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Create a Blank Database

Let's go ahead and create a blank database.

1.

Select a Blank Database

You can create a database from two


different places:

From the Access Welcome screen

Click Blank desktop database from


the Access "welcome" screen (the
screen that is displayed when you first open Access).

From the File > New menu

Alternatively, if you already have


another Access database open, you can
go to the File menu at the top-left
corner of Access, then click New to
bring up the same options.

Click Blank desktop database to


create a new database.

2.

Name the Database

Name the database at the prompt.

For our tutorial, we'll name it Music,


as we'll be creating a music database.

3.

Your New Database!

Your new database has now been created. It's a blank database with a table that is ready
to be configured.
You'll see the menu at the top, and the Ribbon below it containing various options for
customizing your database. We'll be working with them throughout this tutorial.

Customize the Blank Table

First, we're going to add a field to the existing table. Then we'll rename the existing field..

1.

Select a Data Type for the New Field

Right-click Click to Add and select


Short Text from the combo box.

This combo box lists the data types


you can assign to a field. Access
requires that each field is assigned a
data type.

In this case, we're telling Access to only allow Short Text in this field. If a user tries
to enter a different data type, they will receive an error.

Short Text is any string of text up to 255 characters long.

2.

Name the Field

Once you've selected a data type, the


field header will be highlighted with
the text Field1 so that you can
provide a name for the field.

Enter ArtistName as the name of the


field.

3.

Rename the First Field

The first field in our table is currently


called ID. We'll rename it.
Right-click on the ID field header, and select Rename Field. The field will be
highlighted for you to rename it.

Enter ArtistId.

4.

Save the Table

Right-click on Table1 to save the


table.

Enter Artists at the prompt.

5.

Your Finished Table

Your database table now contains two


fields (ArtistId and ArtistName).

Create a New Table

Now we'll create a new table. This one will contain


information on the albums that the artists
release, so we'll call it Albums.

1.
Create a New Table

Ensuring the Create tab is selected


on the Ribbon, click Table.

This will add a blank table called Table1 to the database.

2.

Set up the Fields

Now add 4 fields and rename the first. Set them up as follows:

Field Name Data Type

AlbumId (Leave it as is)

AlbumName Short Text

ReleaseDate Date & Time

ArtistId Number

GenreId Number

Create a new Table in Design View

So now that we've established that Design View and Datasheet View are just two ways of
looking at the same table, let's go ahead and create a table in Design View.

1.

Create the Table

Click Table Design from the Ribbon


(ensuring that the Ribbon is on the
Create tab).

A
blank table called Table1 will be
displayed in Design View.
2.

Add Fields to the Table

Now we will enter each field and


select their data type.

In the first cell under Field Name


add a field called GenreId. Select
Autonumber as its data type.

Under that field, create a new one called Genre and select Short Text for its data type.

3.

Change the Genre Field Properties

Ensuring the Genre field is selected


(by clicking on it), look at the bottom
Field Properties frame.

Double-click somewhere in the


Required row, so that the value now
reads Yes.

Now, double-click in the Allow Zero Length field so that it changes to No.

We have just made the Genre field a required field — all records must have a value in
this field, and it can't just contain a blank string.

You can also click in the row, then use the small button with the down-arrow to change
the value.

Or, you can simply highlight the current value (by clicking on it) and type Yes or No over
the top of it.

4.

Set a Primary Key

Right-click on the GenreId field and


select Primary Key from the drop
down list.
This makes the field a primary key field. Once you've done this, you'll see a little key
icon to the left of GenreId.

A primary key is the unique identifier for the table. Each value in this field will be unique
— no two records in the table can have the same value in the primary key field.

This is why we set it to Autonumber. Access will automatically generate a number


each time a new record is created.

Note that a table can only have one primary key.

5.

Save the Table

Right-click on the Table1 tab and


select Save from the drop down list.

Call the table Genres and click OK.

Set the Field Properties for an Existing Table

You can also use Design View to edit any existing table. Whether the table was created in
Design View or Datasheet View doesn't matter. Any table can be edited in Design View.

Now we will change some field properties to the table we created previously.

1.
Open the Albums table in Design
View

Right-click the Albums table in the left


menu and select Design View from
the contextual menu.

This will open the table in Design View.

You can also open Design View by:

o Right-clicking on a table's tab (if the table's open)


o Clicking the View button at the left of the Ribbon
o Clicking the Design View icon in the bottom right corner of the window (the
Datasheet View icon is on its left)

You can switch back and forth between views at any time by using this method.

2.

Modify the AlbumName Field

Set the AlbumName field to be a required field.

Also set Allow Zero Length to No.

3.

Modify the ArtistId Field

Set the ArtistId field to be a


required field.

Using the Input Mask Wizard

We're now going to apply an input mask to the


ReleaseDate field of our Albums table. Our input mask will ensure that users enter each
album's realease date in the correct format.

1.
Open the Albums
table and Launch the
Input Mask Wizard

Open the Albums


table in Design
View.

Click on the
ReleaseDate
field then look to the
bottom frame. The
bottom frame
displays the properties for this field.

In the bottom frame, click somewhere in the Input Mask row. A small button with
three dots will appear. This button launches the Input Mask Wizard.

Click that little [...] button with the three dots.

2.

Select an Input Mask

The Input Wizard Mask presents you with some options for how you'd like the data to be
entered. You can select any option and test it in the Try It field at the bottom of the
wizard.

Select Medium Date and click Next >.

3.

Customize the Input


Mask

This screen allows


you to make
adjustments to the
input mask. You can
test any adjustments
in the Try It field
at the bottom of the
wizard.
We'll make one
minor adjustment.

Add two zeros, so


that the input mask
becomes: 99-
>L<LL-0000

This will ensure the


user enters the date
as DD-MMM-YYYY. For
example, 20-Mar-
2016.

Once you're happy with the input mask, click Next >.

4. Close the Input Mask Wizard

The Input Mask Wizard will show you one last screen (and give you one last chance to
go back to change your input mask).

Click Finish instead.

5. Your newly created Input Mask

Once the Input Mask Wizard closes, you'll see your newly created input mask against the
Input Mask property in Design View.

You might also like