Lesson 2
Home Up Lesson 1 Lesson 2 Lesson 3 Lesson 4 Lesson 5 Lesson 6 Lesson 7 Lesson 8

ASCII table

Assignment 2

Creating a database

1) When Microsoft Access first starts up, a dialog box is automatically displayed with options to create a new database or open an existing one. If this dialog box is displayed, click Blank Database, and then click OK. If you have already opened a database or closed the dialog box that displays when Microsoft Access starts up, click New Database on the toolbar, and then double-click the Blank Database icon on the General tab.

2) Specify a name and location for the database and click Create. The location for all your files will be your user space in the DPS folder.

After you create a blank database, you must perform additional steps to define the objects that will make up your database.

Creating a Table

Microsoft Access provides four ways to create a blank (empty) table:

Use the Database Wizard to create in one operation all the tables, forms, and reports required for an entire database. The Database Wizard creates a new database; it can't be used to add new tables, forms, or reports to an existing database.
Use the Table Wizard to choose the fields for your table from a variety of predefined tables such as business contacts, household inventory, or medical records.
Enter data directly into a blank datasheet. When you save the new datasheet, Microsoft Access will analyze your data and automatically assign the appropriate data type and format for each field.
Use Design view to specify all of your table details from scratch. This method is going to be the method we will use in this class

Regardless of which method you use to create a table, you can use table Design view at any time to customize your table further, such as adding new fields, setting default values, or creating input masks.

Create a table from scratch using Design view

  1. If you haven't already done so, switch to the Database window. You can press F 11 to switch to the Database window from any other window.
  2. Click the Tables tab, and then click New.
  3. Double-click Design View.
  4. Define each of the fields in your table.

 

Add a field to a table in Design view

  1. Open the table in Design view.
  2. To insert the field within the table, click in the row below where you want to add the field, and then click Insert Rows on the toolbar.
  3. To add the field to the end of the table, click in the first blank row.
  4. Click in the Field Name column and type the name for the field, following Microsoft Access object-naming rules.

 

Object -naming rules
  1. A set of specific rules for naming Microsoft Access objects. In Microsoft Access, names can be up to 64 characters long and can include any combination of letters, numbers, spaces, and special characters except a period (.). an exclamation point (!), an accent grave ('), and brackets ([ ]). Note that you also can't use leading spaces or control characters (ASCII values 0 to 31). For information on Visual Basic naming conventions, search the Help index for "naming conventions."
Avoid including spaces in object names if you'll frequently refer to the objects in expressions or Visual Basic code.
Avoid using extremely long names because they are difficult to remember and refer to.

 

 In the Data Type column, keep the default (Text); or click in the Data Type column, click the arrow, and select the data type you want.

    Data Type Use
    Text Text or combinations of text and numbers, such as addresses. Also numbers that do not require calculations, such as phone numbers, part numbers, or postal codes. Up to 255 characters.
    Memo Lengthy text and numbers, such as notes or descriptions. Up to 64,000 characters.
    Number Numeric data to be used for mathematical calculations, except calculations involving money (use Currency type). Set the FieldSize property to define the specific Number type. 1, 2, 4, 8 or 16 bytes
    Date/Time Dates and times.
    Currency Currency values. Use the Currency data type to prevent rounding off during calculations. Accurate to 15 digits to the left of the decimal point and 4 digits to the right.
    AutoNumber Unique sequential (incrementing by 1) or random numbers automatically inserted when a record is added.
    Yes/No Fields that will contain only one of two values, such as Yes/No, True/False, On/Off.
    Note Number, Date/Time, Currency, and Yes/No data types provide predefined display formats. Set the Format property to choose from the formats available for each data type.

     

  1. In the Description column, type a description of the information this field will contain. This description is displayed on the status bar when adding data to the field and is included in the Object Definition of the table. The description is optional.
  2. Set field properties for the field in the bottom part of the window. Field properties are a set of characteristics that provide additional control over how a field works. For example, setting the Format property to Currency for a field with a Number or Currency data type automatically adds commas, a dollar sign, and two decimal places ($1,234.50). To set a field property, click the field in the upper portion' of Design view, and then set the property in the lower portion. Which properties are available varies, depending on a field's data type. Always change a Text or Number type field's Field Size property.
  1. Define a primary key field before saving your table.
  1. Select the field or fields you want to define as the primary key.
  2. To select one field, click the row selector for the desired field. To select multiple fields, hold down the CTRL key and then click the row selector for each field.
  3. Click Primary Key icon on the toolbar.

Note You don't have to define a primary key, but it's usually a good idea. If you don't define a primary key, Microsoft Access asks if you want it to create one for you when you save the table.

  1. When you are ready to save your table, click Save icon on the toolbar, and then type a name for the table following Microsoft Access object-naming rules.

Assignment