"Microsoft Access 2007 Tutorial Creating a Database using Access 2007
Created: 12 December 2006
Starting Access 2007
Double click on the Access 2007 icon on the Windows desktop (see right), or click-on the Start button in the lower left corner of the screen, then click-on Programs, and then click-on Microsoft Access 2007.
The Getting Started with Microsoft Office Access screen will appear (image below).
For previous Access users: The above menu screen is new in Access 2007. Take a few minutes to peruse this screen. You will notice that (on the top left of the screen) that the “old” Access Templates (already created databases) are still available. As we move through this tutorial, many features of “old” Access will be familiar to you.
1
Microsoft Access 2007 Tutorial Left Mouse Button
In this tutorial, whenever we indicate that you need to click the mouse, it will mean to click the left mouse button – unless we indicate that you should click the RIGHT mouse button. So, always “click left” unless we tell you otherwise.
Creating an Access 2007 Database
This tutorial will assist you in creating a database that includes the features most often used in databases. Once you gain skill with the database you create, you will be able to use and understand the already created Microsoft Access databases mentioned on the last page. We’ll begin with a Blank Database and increase our database knowledge with each step.
Look at the center of your Access screen. You will see – Getting Started with Microsoft Office Access. Below the title you will see a Blank Database button. Click the Blank Database button.
As soon as you click the Blank Database button, the right side of your Access screen will change and look like the image on the left.
Saving your work
One of the unique things about Access database is that it requires you to save your database as soon as you enter the program. You can save your work on a floppy diskette in the A: Drive, on a USB key/Flash Drive or on your C: Hard Disk, or in some other drive. Please save to one of these areas and substitute your Drive in the instructions. To choose the Drive, on which you will save your Access database, click the small folder to the right of File Name:
2
Microsoft Access 2007 Tutorial
A New File Database menu screen similar to the one below will appear when you click the folder.
In the upper left corner of the File New Database menu screen that appears, you will see a Save in: area (see upper left arrow above). Click-on the small down arrow on the right and it will show you the various disk drives available on which you can save (see right upper arrow above). Point to the drive on which you want to save your database, and click-on it. If you choose the 3½ Floppy (A:), make sure you have a formatted disk in the A drive. If you choose the C: drive, choose the folder in which you want to save by double clicking on the folder. Your selection should now appear in the Save in: area Next click-in the area to the right of File Name:. Delete any text that is entered in the area and then type-in the word PERSON as shown at the bottom of the above image (see lower left arrow). Now click-on the OK button or tap the Enter key (see lower right arrow on last page). You will now return to the Getting Started with Microsoft Office Access screen. On the right side of the screen you will see your database File Name and below it, the Drive on which you will create your database. Click the Create button. 3
Microsoft Access 2007 Tutorial Creating a Table
When you click the Create button your Access 2007 screen will change to the image below. This is the “new look” in 2007 Office. You will now see Tabs and Ribbons that automatically appear for the area in Access on which you’re working. Instead of a Menu Bar and drop down selections, you’ll now see these new features. Tabs
Ribbon
Groups When we clicked the Create button Access assumed we desired to create – within our Person database – another database – which is called a Table. You’ll notice that at the top of the above image that the Table Tools and Datasheet Tabs appeared to assist you. The Ribbon below these Tabs is composed of Groups of selections you’ll use to assist you as you create your Table. We’ll be working with these Tabs/Ribbons throughout this tutorial. In the lower portion of the above image you’ll see selections that indicate we are creating a new Table. On the left of the Table Tools-Datasheet Tab/Ribbon you’ll see a View button. Click the View button.
When you click the View button the image on the left will appear. Since we want to create or design a new Table, we’ll click the Design View selection.
A Save As menu screen will appear similar to the image on the right. Type personnel in the Table Name: area and then click the OK button. 4
Microsoft Access 2007 Tutorial
Your Access 2007 screen will now change again – to the image below.
We’ve enlarged the upper left corner of this image below.
Notice (in the image above) that our Table Tools Tab still appears. However, because we are now in the Design process, the lower Tab/Ribbon has changed to Design – to assist us with designing our Table.
5
Microsoft Access 2007 Tutorial
In the image on the last page you will notice that the Primary Key button is “orange” and, in our Personnel Table, that it is also “orange” – with a little key to the left of ID. In database language this is called “keying.” Keying, or indexing, is somewhat advanced. You can get a good description by searching in Help for Keying or Primary Key. To “turn off” the Primary Key, click the Primary Key button. You’ll notice that they Primary Key button is no longer “orange” and the little key is gone from the left of ID. If the Personnel Table image does not “fill” the screen, click-on the small square between the “minus and the X” in the upper right hand corner of the screen (see arrow and image on right). This will Maximize the screen. Notice, under the Blue Bar at the top of the Design screen there are (3) things: Field name, Data Type, and Description
And, in the lower half of the window; Field Properties.
We’ll be creating the Field Names that make up a database. This is similar to creating a blank personnel form (on paper) that will be "filled-in" for each employee (Name, Address, Phone Number, etc.). The areas that will be filled in are called Fields in a database. When you fill in all of the fields for a person, the individual "forms" are called records in a database. There will be a record, or form, for each employee. All the forms, together, make up a Table (database).
6
Microsoft Access 2007 Tutorial
So let’s create a personnel database.
Significant Note:
When creating a database it is always best to “break down” a field into its “smallest parts.” For example – Name would break down into First Name, and Last Name (you could also have Middle Initial, Title, etc.) Address would break down into Street Address, City, State, and Zip (you could also have Apartment Number, etc). Because we are working in Access 2007 it will be very simple to “put the fields back together” with a few mouse clicks when we need to do this. Trust us. This will save you a lot of time later on. Look at the image on the right. Clickin the area or space under Field Name and type-in Last Name (to replace ID). Tap Enter or click-in the area to the right under Data Type. The cursor now moves to the right under Data Type. Click the down arrow under Data Type on right (see arrow on right). Your design screen should look like the one on the right. Now we’ll talk about Data Types.
Data Type
Text You may type in any alphabetical/numerical data that you desire - up to a maximum of 255 characters. As indicated, this is a text field, so you can't do mathematical calculations. Examples of Text data are: names, addresses, stock numbers, room numbers, zip codes, etc. This field is for lots of text. You can have up to 32,000 characters. This field is for numbers where you want to add, subtract, multiply, divide, average, and do numerical calculations. This field can be a very large size, so when we get to Field Properties, we'll talk about "sizing" this field so it doesn't take up to much "space" in storage. Dates and Times. You may format these later, as you may desire. Dollars ($). You may format these later, as you may desire. This field is an "automatic" counter that assigns a number each time you put data into a new field. This is a "True/False" or "Yes/No" type of field.
Memo Number
Date/Time Currency AutoNumber
Yes/No
7
Microsoft Access 2007 Tutorial
OLE Object This means "Object Link Embedding" which indicates you can insert a graphic, picture, sound, etc. Pretty neat to put a photograph in a personnel record or a picture of an inventory item in the stock record (advanced stuff). Since this is a simple, introductory Access tutorial, we won’t work with Hyperlinks, Attachments, or Lookup Wizards. We'll leave Last Name as a Text Data Type. To the right under Description you may make any remarks you feel are appropriate to someone who may want to know how/why you designed the field as you did. Now notice in the lower part of the screen, under Field Properties, that a box appeared when you selected the Text Data Type. This box is "tailored" to the Text Data Type that you selected above. Your Field Properties should look like the one below when you finish doing the steps indicated below.
Field Properties
Click-in each area (to the right of the words) as you read about it below
Field Size Is currently set to 255 characters. That's pretty large for a name. So, clickin this area and change the number to 25 (you can make this larger or smaller later if you have to).
Format
Now click-in the Format Area. Next tap the F1 function key to activate Help. Since you are in the Format area, Help will be "tailored to" this area. When the Help Window appears, click Format Property.
Now click Text and Memo Data Types. Notice that there are several choices to make your characters upper or lower case. This gives you an idea of some formats. We'll use one later. Now click-on the “X” in the upper right corner of the Microsoft Access Help – Format Property Window to close it.
8
Microsoft Access 2007 Tutorial
Input Mask Caption Default Value Validation Rule Validation Text Required Allow Zero Length Indexed
We'll come back to this feature later. Look at the Light Blue Help area to the right. It explains about Caption. We'll come back to this feature later. We'll come back to this feature later. We'll come back to this feature later. Look at the Light Blue Help area to the right. Look at the Light Blue Help area to the right. Look at the Light Blue Help area to the right.
Unicode Compression Look at the Light Blue Help area to the right. IME Mode IME Sentence Mode Smart Tags
Look at the Light Blue Help area to the right. Look at the Light Blue Help area to the right. Look at the Light Blue Help area to the right.
Now we’ll repeat this process and create different Field Names and Data Types. Type-in the Field Names as indicated below and set them to the Data Types and Sizes indicated. Start each new Field Name and Data Type - below the previous field (see example below)
Field Name Last name First name Social Security #
Data Type Text Text Text
Size 25 20 15 (Already Completed)
9
Microsoft Access 2007 Tutorial
We'll use an Input Mask for our Social Security Number. Click-in the Input Mask area in the Field Properties area at the bottom of the screen (see left arrow below).
Notice the three "dots" (...) in a box on the right. Click-on the three dots (see right arrow above). An Input Mask Wizard will appear: "Must Save Table First. Save Now?".
Click-on Yes.
A Save As Window may now appear. If it does, type-in Personnel in the area under Table Name:, and click-on OK.
The Input Mask Wizard will show you some Sample Masks (you may scroll up/down to view them). We'll use Social Security Number, so click-on it. Your screen should look like the one below. Now click-on Next at the bottom of the Input Mask Wizard screen. You will now see a default number of 000-00-0000 using dashes (-) between the numbers. You can use anything you want.
10
Microsoft Access 2007 Tutorial
We'll leave it as is, so click-on Next> again (at the bottom of the Input Mask Wizard screen). On this Input Mask Wizard screen you’ll see two choices. Click-in the little circle to the left of With symbols in the mask, like this:. Sometimes, when we use Access data as a part of mail merges or in labels, if we don’t save the dashes, they won’t appear in our document. So, it always a good idea to save dashes.
Click-on Next> again.
Now click-on Finish.
You will see some “special” numbers written in the Input Mask area for Social Security #. When you begin to enter data in this field, you’ll see how this works. Your Field Properties area should look like the image below.
11
Microsoft Access 2007 Tutorial
Now continue entering the following information in the Field Name and Data Type areas as we did above.
Street address City State
Text Text Text
25 20 2
Here we'll use a Format. First make the Field Size 2 then click-in the area to the right of Format.
A down pointing arrow, like the one above (see arrow), will appear on the right side of the Format area. If you click-on the arrow, the area will appear blank (that's because we haven't entered a Format). Tap the F1 key in the row of Function Keys at the top of the keyboard. A Help menu screen “tailored” to Format will appear )like the one below). Since you are in the Format area, Help will be "tailored to" this area. When the Help Window appears, click Format Property.
Since we are working with a Text Data Type, click-on Text and Memo Data Types (see arrow below).
12
Microsoft Access 2007 Tutorial
Notice that a > will change any alphabetic character you type into all upper case letters. Now point and click the “X” in the upper right hand corner of the Format Help Screen (notice that the Help Window closes "automatically").
Now type a > in the Format area. Your Field Properties area should look like the one below.
Continue entering the following information in the Field Name and Data Type areas as we did above.
Zip Gender
Text Text
5 1
Insert a > in the Format area to make all gender entries become upper case (capitals - like you just did for State).
Favorite Number
Number
(Note: this is the first Number field)
Here we'll learn about Numbers, the Validation Rule and Validation Text. We'll limit the person's favorite number to a number between 1 and 999. Leave the Field Size set to Long Integer. Now click-in the area to the right of Decimal Places. It currently indicates Auto. When you click, you will see a little down arrow on the right side of the area. Click-on the little arrow. Select “0.” This indicates that decimal places are not allowed in the Favorite Number.
13
Microsoft Access 2007 Tutorial
Next, click-in the Validation Rule area. We'll "build" a mathematical expression that will only allow numbers from 1 to 999. Type in the following expression (in the area to the right of Validation Rule):
> 0 and < 1000
This tells Access that the number entered must be between 1 and 999. You’ll notice that when you click-in the Validation Rule area that three periods (…) appear just like they did in Input Mask. If you want to click-on the three periods they will bring up an Expression Builder which you can use to create the mathematical formula above. Please note that frequently, if you are really not great at math, the Expression Builder can cause problems. Sometimes, the Expression Builder will “insert” an <<expr>> in the formula. If it does this, delete the <<expr>>. This will confuse Access, and will frequently cause the program to “stop” until you remove <<expr>>. So, if you want to look at Expression Builder, please do so. But – be careful. If someone does not enter a number correctly, an error message will appear. Now we'll create an appropriate error message. Click-in the Validation Text area and type-in:
Favorite Number must be between 1 and 999.
14
Microsoft Access 2007 Tutorial
When you finish all of the above, your Field Properties should look like the one below.
Continue entering the following information in the Field Name and Data Type areas as we did above.
Date hired
Date/Time
In Format area click the small down arrow on the right side of the Format area and choose Short Date. In the Input Mask area click the three dots (...), Save the table, and choose Short Date again, click Next>, click Next> again, then click Finish. (This will insert a / between the day, month, year). Your Field Properties should look like the image below.
Salary
Currency
In the Decimal Places Field Properties area click-on the small down arrow on the right side and select 0 – this indicates “no cents.” Type a 0 (zero) in the area to the right of Default Value. This will indicate 0 income if no Salary figure is entered. Your Field Properties screen should look like the image below.
15
Microsoft Access 2007 Tutorial
Application Received Yes/No
We’ll make this a “Yes/No” or “check box” field. When we begin entering data in the database, you’ll see how this “box” works.
Now that we have created our Person Database and Personnel Table it would be a good time to Save the last few changes.
Microsoft Office Button
The Microsoft Office Button has replaced File in the Menu Bar. In the upper left corner of your Access 2007 screen you will see a button similar to the image on the right. This is the Microsoft Office Button. Click the Microsoft Office Button.
You will now see the Access 2007 Microsoft Office Button selections. First, notice that many of the “old” FileMenu Bar choices are included in this menu (they are all here – we’ll show you). Since we Saved our database at the beginning of the tutorial, we only have to click the Save choice.
16
Microsoft Access 2007 Tutorial Quick Access Toolbar
You could also click the small diskette in the Quick Access Toolbar in the upper left corner of your Access screen.
Entering data in the database
At this point you will still be in the Design view. To enter data into your Table you will need to be in a Datasheet View. In the upper left corner of your screen (under the Home Tab) you will see that the first button on the left that has a small sheet of paper (see arrow on the right) – the View button. Point to this button with the mouse and pause, you will see a "Tool Tip" that indicates that this button is the View Button. This is logical because you have been designing your table and now want to view the data that you will enter in your Table (database). If you are familiar with spreadsheets it looks like a tiny version spreadsheet. Click the View button. When you click the View button, the top of your Access screen will look like the image below. Notice that all of the Fields you created are – in the order you created them – along the top of the Table.
Some of the Field Names may be “cut off” a bit. We’ll widen our fields in a moment. You can enter data in each Field. But let’s widen some of our columns a bit so we can see the titles.
Widening Columns in Datasheet View
To widen columns so you can see the Field Names in the Datasheet View you will need to move your cursor over the “line” between two Field Names (like we did in the image above). When our cursor was over the line between Street Address and City, it turned to a line with two arrows pointing left and right. When you see this line with the arrows, click and hold down the left mouse button and move your cursor to the right a bit. You will see the column get larger as you move your cursor. When you have the column..."
|
You need to upgrade your Flash Player , or try to enable javascript in order see this document properly.
|
|