Open Directory Site Microsoft Access2000 Tutorials

Home | Word | Excel | AccessFrontPage | Outlook | PowerPoint | Internet Explorer

Home >> Microsoft Office XP >> Access 2000 >> Data Type

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, zip codes.

 

Memo             This field is for lots of text.  You can have up to 32,000 characters.

 

Number           This field is for numbers where you want to add, 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.

 

Date/Time      Dates and Times.  You may format these later, as you may desire.

 

Currency         Good old Dollars ($).  You may format these later, as you may desire.

 

Counter           This field is an "automatic" counter that assigns a number each time you put data into a new field.

 

Yes/No            This is a "True/False" or "Yes/No" type of field.  You can make it anything you desire under Field Properties.

 

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).

 


 

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 50 characters.  That's pretty large for a name.  So, click-

                        in this area and change the number to 25.

 

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-on Text and Memo Data Types (Notice that you click-on different Data Types depending on the Type you selected.)  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 Help Window to close it.

 

Input Mask                      We'll come back to this feature later.

 

Caption                    Look at the Gray Help area to the right.

 

Default Value        We'll come back to this feature later.

 

Validation Rule    We'll come back to this feature later.

 

Validation Text     We'll come back to this feature later.

 

Required              Look at the Gray Help area to the right.

 

Allow Zero Length          Look at the Gray Help area to the right.

 

Indexed                                Look at the Gray Help area to the right and tap F1 (Help)

 

Unicode Compression     Look at the Gray Help area to the right.

 

Now we will repeat this process and create different Field Names and Data Types (as necessary).  Type-in the Field Names as indicated below and set them to the Data Types and Sizes indicated

 

Field Name             Data Type               Size

 

Last name                          Text                       25      (Already Completed)

First name                         Text                       20

Social Security #               Text                       15

 

Here we'll use an Input MaskClick-in the Input Mask area.  Notice there are three "dots" (...) in a box on the right.  Click-on the three dots.  A message will appear:  "Must Save Table FirstSave Now?". 

 

 

Click-on Yes

 

In the Save As Window we'll save our Table as Personnel, so type-in Personnel in the area under Table Name:, and click-on OK.  Next a box will appear saying There is No Primary Key defined.

 

Click on NO.  (Keying is somewhat advanced.  You can get a good description by searching in Help for Keying.)  


 

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 window.  You will now see a default number of 000-00-0000 using dashes (-) between the numbers.  You can use anything you want.  We'll leave it as is, so click-on Next> again.  On this menu screen you’ll see two choicesClick-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.  Now, 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 one below.

 

 

 

Now continue entering the following information in the Field Name and Data Type areas as we did above.

 

 

Street address                               Text                        25

City                                                Text                        20

State                                              Text                         2

 

 

Here we'll us a Format.  First make the Field Size 2 then click-in the area to the right of Format

 

A down pointing triangle, like the one on the left, will appear on the right side of the Format area. If you click-on it the area will appear blank (that's because we haven't entered a Format).  Tap 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 we are working with a Text Data Type, click-on Text and Memo Data TypesNotice 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                                                  Text                         5

Gender                                           Text                         1

 

Insert a > in the Format area to make all gender entries become capitals (like you just did for State).

 

Favorite Number                           Number    (Note: this is the first Number field)                  

 

Here we'll learn about Numbers and the Validation Rule and Validation Text properties.  We'll limit the person's favorite number to a number between 1 and 999.  Leave the Field Size set to Long Integer (Tap the F1 Function Key [Help] to view the different Number Field Size descriptions).   After you have viewed the Number Help screens, click the small “X” in the upper right hand corner of the Help screen to close the Help screen. 

 

Now click-in the area to the right of Decimal Places.  It currently indicates Auto.  When you click there you will see a little down triangle on the right side of the area.  Click-on the little triangle.  Select “0.”  This indicates that decimal places are not allowed in the Favorite Number.

 

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, that the Expression Builder can cause problems.  Sometimes, the Expression Builder will “insert” a <<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.

 

When you finish all of the above, your Field Properties should look like the one below.

 

 

 

 

Date hired                                          Date/Time

 

In Format click-on the small down triangle on the right side of the Format area    and choose Short Date.  In the Input Mask area click-on the three dots (...), save the table, and again choose Short Date, then Next>, then Next> again, then Finish.  (This will insert a / between the day, month, year.)

 

Salary                                                 Currency

 

In the Decimal Places area click-on the small down triangle on the right side     and select 0 (zero) – this indicate “no cents.”  Notice the Default Value of  0 income will be inserted if no Salary figure is entered.  We'll leave it at zero.

 

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.

 

 

Point to and click on File in the Menu Bar then click on Save As.  The Save As Window will appear and Personnel should appear under Table Name: Click-on OK.  You could also click on the small diskette Save Button if you are used to doing this.

 

Cheap Web Hosting Articles - Web Site Design & Web Hosting Tutorials - Domain Hosting