`
`
`
`
`
`Merrill Communications LLC
`d/b/a Merrill Corporation
`Exhibit 1005 pt 4
`
`
`
`Creating Recess Tables
`
`n order to manage data with Access,
`you must store the data in tables. If
`the data you want to work with is
`already stored in a computer database somewhere, you probably can use Access to get
`at it as Chapter 7 explains. But if the data exists on paper only or it isn't yet available
`or it's in a format that Access can't import or link, your first step is to structure tables
`that will store the data. This chapter is all about creating tables.
`If you used the Database Wizard to create a database, you can skip this chapter and
`continue with Chapter 8 to learn more about entering data into your tables. You can
`always return to this chapter later if you need to add, change, or delete table fields.
`If you'd like to review or dive more deeply into topics covered in this chapter, go to
`the Access Contents Index; open the Creating, Importing, and Linking Tables book; and
`then explore the subtopics. For hands-on practice with creating and opening a database
`and its tables, see Chapter 3.
`
`Creating the Database
`
`If you haven't done so already, you must create a database in which to store your tables
`as explained in Chapter 5. If you have created a database already, be sure to open that
`database (see Chapter 1).
`
`
`
`156
`
`CHAPTER 6 • CREATING ACCESS TABLES
`
`.... c>-.-E.
`Remember, a table is not the same as a database. A database can contain any num(cid:173)
`ber of tables. So don't create a new database each time you want to create a table.
`As long as your new tables are related to other tables in the current database in
`some way, you should continue to add those new tables to the current database.
`
`Using the Table Wizard to Create Tables
`
`Want a table in a hurry? Then follow these steps for using the Access Table Wizard:
`
`1. Click on the Tables tab in the database window and then click on the New button.
`Or click on the drop-down arrow on the New Object toolbar button (shown at left)
`and choose New Table. Or choose Insert>- Table. You'll see this New Table dialog
`box next:
`
`New Table
`
`D£1
`
`De~ign VR:w
`Table INizaJd
`I mporl Table
`Link Table
`
`Create a new lable in
`
`I Dalasheet=vie=w,....--,.....,~'
`
`OK
`
`Cancel
`
`2. Double-click on Table Wizard to open the Table Wizard dialog box, shown in
`Figure 6.1.
`3. Choose either Business or Personal from the option buttons.
`4. Scroll through the list of tables and then click on the sample table name that best
`describes the information you want to store (Mailing List, Contacts, Customers, or
`whatever).
`5. Click on a field name in the Sample Fields list for each field you want to include in
`the table and then click on the> button (or double-click on a field name). Or click
`on the» button to copy all the sample fields to your table. The field names will be
`copied to the Fields in my new table list in the order you specify. Here arc some
`ways to manage the Fields in my new table list:
`
`• To delete a field, click on that field in the Fields in my new table list and then
`click on the < button.
`• To delete all fields in the Fields in my new table list, click on the « button.
`
`
`
`ll#rlWD*
`The Table Wiz(cid:173)
`ard dialog box
`will help you
`create a table.
`
`USING THE TABLE WIZARD TO CREATE TABLES
`
`157
`
`•
`
`Table Wozard
`
`WIVch ollhe s~ tables isted below do you wont to use to aeate l'O<M table?
`AJJ,.,.
`11100 utripler~ r.hdo'•lhe -~ ~eldl ~ v'Ml to ;..clild6 in )IOl• rrew table.
`(OU·l~~ 0<10 ~ liekb lrC111111\o1~ ih~~r~ CICl!! •«flllle I~ If yo<,.r4 riQI ure <&!~ a field.
`Qb~~~ i ll'<llll~V todelsteafoeldl<lter
`Sample Tables:
`Sample Fields:
`
`Fields in mv new table:
`
`P1oliK
`FirstName
`MiddleName
`LastName
`Suffix
`t::J Nickname
`Title
`OrganizationN ame
`A~1es•
`
`• To move a field up or down in the list, first delete that field from the Fields in
`my new table list. Next, in the Fields in my new table list, click on the place
`where the field should appear. Finally, double-click on the appropriate field
`name in th
`ample Field · list.
`• To change a field's name, click on that field in the Fields in my new table list,
`click on the Rename Field button, type a n ew name for the field, and then click
`on OK.
`
`As for all the Wizards, you can click on the Back button to back up to a previous dia(cid:173)
`log box, Next to continue to the next dialog box, Finish to zip to the finish line, and
`Cancel to exit the Wizard without creating the table. Always look at each Wizard
`dialog box carefully for previews, tips, and other information that will help you
`decide what choices to make and what to do next.
`
`6. Click on the Next button when the Fields in my new table list contains Lhe l'ielcls you
`want to include in your table. The next lialog box suggests a name for tl1e new table.
`i1 a table with this name doesn 't alr '"ady
`7. Leave t he suggested name unch ang d
`exist in the database) o r type a new name. See th e sidebar "Object aming Rul ·"
`for delails about how t oam
`ta bles and oth er objects.
`8. Assign a pri ma ry k y. Y u have two oplions:
`
`• To have Access make the decision for you (the easiest method), select Yes, Set
`A Primary Key For Me, and click on Next.
`
`
`
`158
`
`CHAPTER 6 • CREATING ACCESS TABLES
`
`• To make your own decisions about the primary key, select No, I'll Set The
`Primary Key, and click on Next. In the next dialog box, choose from the drop.
`down Jist whichever field will be unique for each record. You'll also need to tell
`Access which type of data the primary key field will contain (numbers that Access
`assigns, numbers that you enter when you add new records, or numbers and/or
`letters that you enter when you add new records). When you're done choosing pri(cid:173)
`mary key options, click on Next.
`
`If you're not sure about how to handle primary key fields just now, don't worry
`about it. Select Yes, Set A Primary Key For Me in step 8 and click on Next. You'll
`learn more about primary keys later in this chapter, under "Setting a Primary Key."
`
`9. If your database already contains at least one table, you'll be asked to specify
`whether your new table is related to other tables in your database. Here's what you
`can do:
`
`• If you're not sure about the table relationships, click on Next to continue
`with the next dialog box for now. You can define relationships later, if neces(cid:173)
`sary, when you understand more about them. "Defining Relationships Among
`Tables," later in the chapter, explains relationships and shows how to define
`them anytime.
`• If you do know which relationships you want to define between the table
`you're creating and another table that already exists in the database, click on
`the related table in the list and then click on the Relationships button. In the
`next dialog box, tell Access how your new table is related to the existing table
`and click on OK. Repeat this step until you've defined all the relationships you
`want and then click on Next.
`
`10. Follow the prompts in the final dialog box (which displays a checkered flag) to tell
`the Wizard what to do after creating the table. Then click on the Finish button to
`create the table.
`
`You'll be taken to the table design window or to the datasheet view or to a form,
`depending on your choice in step 10. To return to the database window now, choose
`File> Close from the Access menu bar or click on the Close button on the window that
`appears or press Ctrl+W. If you're prompted to save your changes, click on Yes or No as
`appropriate.
`
`
`
`USING THE TABLE WIZARD TO CREATE TABLES
`
`159
`
`When you use the Table Wizard to create a table, Access automatically sets up
`.,...=-- input masks for certain fields (such as those that store telephone and fax num(cid:173)
`bers, postal codes, and dates). Input masks make data entry easier by controlling
`where data is entered, what kind of data is allowed, and how many characters
`you can enter. You'll find more about input masks later in this chapter.
`
`Object Naming Rules
`Access gives you considerable freedom
`when assigning names to tables, table
`fields, forms, reports, queries, macros,
`and modules. Still it will complain if you
`don't follow the naming rules, which are
`as follows:
`
`• The name cannot be the same as
`any other object of the same type
`within the database. For example,
`you can't have two tables named
`Mailinglist; however, it's OK to have
`one table named Mailinglistl and
`another named Mailinglist2.
`
`• You cannot give a table and a query
`the same name.
`
`• When naming a field, control, or
`object, make sure your name isn't the
`same as the name of a property or
`other element that Access is already
`using. This rule is especially important
`if you're writing Visual Basic code.
`
`• The name can be up to 64 charac(cid:173)
`ters, including spaces. However, the
`name cannot start with a space.
`
`• The name can include any combina(cid:173)
`tion of letters, numbers, and spaces.
`
`• The name can include punctuation
`characters except a period (.), an
`exclamation mark (!), an accent
`grave (A), or brackets ([ ]).
`
`• If you plan to write programs for use
`with your database, avoid using spaces
`in object names. For example, use
`Customerlnfo instead of Customer Info
`(for a table name) or LastName instead
`of Last Name (for a field name). Pro(cid:173)
`gramming is easier when the object
`names do not include spaces.
`
`• The name cannot include control
`characters (ASCII 00 to ASCII 31 ).
`
`• When naming fields, avoid choosing
`names that are the same as built-in
`Access function names or property
`names. Strange things may happen if
`you do.
`
`For more about naming rules, look up
`Naming Rules in the Access Answer Wizard
`and then double-click on appropriate sub(cid:173)
`topics. For a complete list of Microsoft
`Access specifications, look up Specifica(cid:173)
`tions in the Access Answer Wizard and
`then double-click on Look Up Microsoft
`Access Specifications under How Do I.
`
`
`
`160
`
`CHAPTER 6 • CREATING ACCESS TABLES
`
`We'll talk about the table design window and ways to change a table's structure later
`in this chapter. But first, let's look at ways to create a table without a Wizard. The pro(cid:173)
`cess begins with planning a table from scratch .
`
`Planning a Table trom Scratch
`
`Instead of using the Table Wizard to create a table, you can plan and create a table from
`scratch . Your first step is to decide which fields to include in your table. If you're work(cid:173)
`ing from a fill-in-the-blank paper form, this task can be easy. Generally speaking, you
`can create one field for every "blank" on the form. An accountant, for example, might
`create a table that has a field for each blank on a Federal 1040 tax form. There's one
`catch to this one-blank, one-field approach: You generally should not include fields
`that contain the results of calculations. Why not? Read on.
`
`Do Not Include Calculated Fields
`
`Access can perform instant, accurate calculations on any data in your table and then
`display the results in queries, forms, and reports (which you'lllearn about in upcoming
`chapters). So, for best results, do not create fields that store the results of a calculation.
`Here are the potential problems with storing calculation results in the table:
`
`• You risk printing faulty totals or results that aren't based on up-to-the-minute data.
`• You're wasting disk space. After all, there's no need to store what Access can calcu(cid:173)
`late on-the-fly for you.
`• You'll need to do the calculations yourself. Unless you're some kind of human
`calculator, doing the calculations yourself is a waste of time and can lead to errors.
`
`In short, tables should contain raw data only-just the numbers you'll need to base
`calculations on later-and not the results of any calculations.
`
`Creating a Table without Using a Wizard
`
`Follow these steps to create the table from scratch, without using the Table Wizard:
`
`1. Click on the Tables tab on the database window and then click on the New button.
`Or click on the drop-down arrow on the New Object toolbar button and choose
`New Table. Or choose Insert > Table.
`2. Double-click on Design View in the New Table dialog box that appears next.
`
`
`
`CREATING A TABLE WITHOUT USING A WIZARD
`
`Chapter 8 explains how to define fields simply by entering data into a blank data(cid:173)
`sheet; it also explains how to add, rename, and delete fields from datasheet view.
`
`You'll be taken to the table design window (see Figure 6.2) where you tell Access
`which fields will go into the table.
`
`You might want to use the Table Wizard to set up a table that's almost like the one
`you want. Then right-click on the table name, choose Design, and use the tech(cid:173)
`niques described in this chapter to tweak the table structure to perfection.
`
`•
`
`lildMDW
`Use the table
`design window
`to define the
`name, data
`type, and prop(cid:173)
`erties of all
`fields in a table.
`
`~ VieW. f6 Switch panes. Fl =Help.
`
`Property tabs
`
`Hint box
`
`
`
`162
`
`CHAPTER 6 • CREATING ACCESS TABLES
`
`Defining a Table's Fields
`Next you must define the fields in your table by following the steps below. As you
`define the fields, glance at the hint box in the table design window for guidance. (You
`also can press Fl for more information as you follow each step.)
`
`1. Type a field name (up to 64 characters including blank spaces) in the Field Name
`column. Field names must follow the rules given earlier in this chapter (see the
`sidebar "Object Naming Rules").
`2. Click on the Data Type column next to the field name and select the appropriate
`data type from the drop-down list. (See "Choosing Appropriate Data Types" below
`for more information.)
`3. Click on the Description column and type a description of the field (a description
`is optional, but very helpful). This description will appear on the status bar later
`when you're entering data.
`4. (Optional) Click on the General or Lookup tab in the Field Properties area and set prop(cid:173)
`erties for the field you're defining. See "Setting Field Properties" later in this chapter.
`5. Repeat steps 1 through 4, putting each field definition on its own row until you've
`defined all the fields in your table.
`
`When you've finished defining the table's fields, save the table structure as discussed
`shortly under "Saving a Table Structure."
`
`If you prefer to let a Wizard guide you through setting up a field, click in the Field
`Name column where you want the new field to appear. Then right-click and
`choose Build from the shortcut menu or click on the Build toolbar button (refer to
`Figure 6.2). The Field Builder will guide you through the remaining steps.
`
`Choosing Appropriate Data Types
`Access can store different types of information in different formats. So when you're
`defining a table without a Wizard, you must think about what type of information will
`be stored in each field.
`To define the data type of a field, click in the Data Type column next to the field
`name and then click on the drop-down list button that appears. You'll see the list
`
`
`
`CREATING A TABLE WITHOUT USING A WIZARD
`
`63
`
`shown below and you can select a data type by clicking on it. Table 6.1 summarizes the
`data types you can choose.
`
`Be sure to assign the Text data type-rather than the Number data type-to fields
`such as telephone numbers, fax numbers, postal codes, and e-mail addresses.
`Unlike the Number data type, the Text data type lets you enter punctuation char(cid:173)
`acters and letters, as in these examples: (520)555-5947 for a telephone or fax
`number; 73444,2330 or Hanley@RNAA47.com for an e-mail address; 85171-1234
`or H3A3G2 for postal codes.
`
`I
`
`TABLE 6.1: ACCESS DATA TYPES
`
`DATA TYPE
`
`AutoN umber
`
`Currency
`Date/Time
`
`Hyperlink
`Lookup
`
`Memo
`
`STORES
`
`A number that's assigned automatically and never changes again .
`Tip: Use the New Values property on the General tab to control
`whether numbers are assigned incrementally or randomly.
`Dollar amounts.
`Dates (e.g., 12/31 /96) and times. Tip: Use the Format property
`on the General tab to control the appearance of the date.
`Hyperlink addresses.
`Values that come from another table, a query, or a list of values
`you supply. Tip: Use the Lookup tab properties to define a
`lookup field or choose the Lookup Wizard data type to set up
`the lookup field automatically.
`Large bodies of text up to 64,000 characters in length .
`
`Continued I ~
`
`
`
`164
`
`CHAPTER 6 • CREATING ACCESS TABLES
`
`I
`
`TABLE 6.1: ACCESS DATA TYPES (CONTINUED)
`
`DATA TYPE
`
`Number
`
`OLE Object
`
`Text
`
`Yes/No
`
`STORES
`
`True numbers such as quantities. Tip: Use the Field Size, For(cid:173)
`mat, and Decimal Places field properties on the General tab to
`control the size and appearance of numbers.
`Any OLE object such as a picture, sound, or word processing
`document.
`Any written text up to 255 characters in length, numbers that you
`won't be using in arithmetic calculations, and certain numbers like
`codes such as zip codes, phone numbers, or product codes that
`contain letters, hyphens, or other nonnumeric characters.
`A True or False value only. Tip: Use the Format property on the
`General tab and the Display Control property on the Lookup
`tab to control the appearance of the field's contents.
`
`To learn more about how to decide what data type to use for fields in a table, click
`in the Data Type column on the table design window and press Pl. Or search for Data
`Types topics and subtopics in the Access Help Index.
`
`Defining Field Properties
`
`You can change a field's properties (characteristics) using options on the General and
`Lookup tabs below the Field Properties area in the table design window's lower pane.
`Different data types offer different properties.
`
`The Field Properties area of the table design window shows the field properties for
`only one field at a time. Check to make sure the ~ symbol on the row selector is
`pointing to the appropriate field name in the upper pane before you change
`properties in the lower pane.
`
`To set a property for a field, follow these steps:
`
`1. Select the appropriate field in the table design window's upper pane.
`2. Click on the appropriate tab (General or Lookup) in the Field Properties area in the
`table design window's lower pane.
`3. Click in the box next to the property you want to set.
`
`
`
`CREATING A TABLE WITHOUT USING A WIZARD
`
`165
`
`4. Do any of the following:
`
`• Type a value for the property.
`• Click on the drop-down arrow (if one appears) next to the property and click
`on an option in the list that appears. For properties that offer a drop-down list,
`you also can double-click on the appropriate property box to cycle through the
`available values for that property.
`• Get help in setting the property by clicking on the Build button (if one appears)
`or right-clicking on the field and choose Build.
`
`You can get immediate help as you define field properties by pressing Fl. You also
`can search for Fields, Properties in the Access Help Index.
`
`Important General Field Properties
`Here (in alphabetical order) are the most important field properties on the General tab.
`(We'll get to the Lookup properties later in this chapter.)
`
`If Yes, the field will accept an "empty string" as a valid
`Allow Zero Length
`entry, even if the Required property is set to Yes. That empty string will appear as
`two quotation marks with nothing in between ("")when first typed into the field;
`those quotation marks will disappear when you move the cursor to another field.
`Caption Lets you define an alternative name for the field to be used in datasheet
`view and as labels when you create forms and reports. The caption offers a handy
`way to make your datasheet columns and labels more readable when field names
`do not contain spaces. Example: If you've named a field LastName, specify that
`field's Caption property as the more readable text Last Name.
`Decimal Places Lets you specify the number of digits to the right of the decimal
`separator in a numeric field. Choose "Auto" to have the Format property deter(cid:173)
`mine the number of decimal places automatically.
`Default Value Lets you define a value that's automatically inserted into the
`field; you can type a different value during data entry, if necessary. (See Table 6.2
`for examples.) The default value for a Text field is the empty string; for a Number
`or Currency field, it's 0.
`Field Size Lets you specify the maximum length of text allowed into the field or
`the acceptable range of numbers. The default size for text is 50 and for numbers is
`Long Integer, although you can change these settings by choosing Tools >
`Options, clicking on the Tables/Queries tab, and changing values in the boxes
`under Default Field Sizes (see Chapter 15).
`Format Lets you define the appearance of data in the field.
`
`Cll .,
`
`Ill
`..CI
`~
`Ill c
`
`Ill
`
`Cl c .. Ill
`
`~ u
`
`
`
`166 I CHAPTER 6. CREATING ACCESS TABLES
`
`Access doesn't pad text that's shorter than its allotted width to fill out the rest of
`_ """'" .... the field. Hence there's no disk consumption penalty for making the size of a Text
`field wider than it needs to be. However, a smaller maximum field size can con(cid:173)
`serve memory and speed up processing.
`
`I
`
`TABLE 6.2: EXAMPLES OF DEFAULT VALUES YOU CAN ASSIGN TO J\._FIELD
`
`DEFAULT VALUE
`
`FILLS FIELD WITH
`
`=Date()
`=Now()
`0
`Yes
`No
`CA
`
`Today's date (use the Date/Time data type)*
`Current date and time (use the Date/Time data type)*
`The number zero (use with Number and Currency data types)
`A "True" setting (use with Yes/No data type)
`A "False" setting (use with Yes/No data type)
`The letters CA (for a Text field that defines the two-letter state
`abbreviation for California, used in the United States)
`
`• Use the Format property on the General tab to determine the appearance of the field's contents
`
`Indexed Lets you choose whether to index this field and whether to allow dupli(cid:173)
`cates in the index. See "Defining Indexes" later in this chapter for more details.
`Input Mask Lets you define a pattern for entering data into the field. For help
`with creating the mask for a text or date/time field, click on the Build button after
`selecting this property. The Input Mask Wizard will guide you through each step.
`You also can press Fl for h elp when the cursor is in the Input Mask property box.
`Required
`If set to Yes, the field cannot be left blank.
`Validation Rule Lets you create an expression that tests data as it comes into the
`field and rejects faulty entries. (See Table 6.3 for examples.)
`
`In addi tion to specify ing a validation rule, you can limit the e ntry in a field to values
`from anothe r table. To do so, you can (1) define relationshi ps between tables;
`(2) define lookup fields; or (3) create a drop-down list in a fo rm . We'll explain the
`first two methods later in th is chapter a nd the thi rd method in Chapter 1 3.
`
`
`
`CREATING A TABLE WITHOUT USING A WIZARD
`
`Validation Text Defines the error message that will appear on the screen when
`faulty data is entered into the field. When writing the validation text, it's best to
`indicate which field is invalid so the user can more easily understand what's
`wrong during data entry. (See Table 6.3 for examples.)
`
`To test all your validation rules against existing data in the table, choose Edit>- Test
`Validation Rules >- Yes.
`
`I
`
`TABLE 6.3: EXAMPLES OF VALIDATION RULE EXPRESSIONS AND TEXT FOR ERRORS
`
`VALIDATION RULE
`
`POSSIBLE
`VALIDATION TEXT
`
`HOW IT
`LIMITS ENTRY
`
`>0
`
`<>0
`
`Between 1 and 1 00
`
`>=Date()
`
`>=#1/1/96#
`
`The Unit Price must be
`greater than 0.
`
`A Rating of 0 is not
`acceptable.
`
`The Rating must be
`between 1 and 1 00.
`
`Sorry, no Order Date
`backdating is allowed!
`
`Sorry, First Payment date
`must be January 1996
`or later.
`
`Disallows 0 or negative
`number in a Number or
`Currency field .
`Allows any negative or
`positive number, but
`not zero.
`Accepts only numbers in
`the range of 1 to 100
`(inclusive) in a Number or
`Currency field.
`Allows only today's date
`or later dates in a Date/
`Time field.
`Prevents dates earlier than
`january 1, 1996, in a
`Date/Time field.
`
`~ "' "' .Q
`~
`"' en c
`~ "' f!
`u
`
`Setting a Primary Key
`
`A primary key is a field (or fields) that uniquely identifies each record, much as a license
`plate uniquely identifies each car on the road. When you define a primary key, you tell
`Access to do three things:
`
`• Make sure no two records in the table have the same value in the field (or fields)
`that define the primary key
`• Keep records sorted (ordered) by the entries in the primary key field
`
`
`
`168
`
`CHAPTER 6 • CREATING ACCESS TABLES
`
`• Speed up processing
`
`A primary key can be just one field, or it can consist of two or more fields. When two
`or more fields define a primary key, Access doesn't consider records to be duplicates
`unless the combined contents of all the fields in the primary key are identical.
`
`No field that is part of a primary key can ever be left blank during data entry.
`
`To set a primary key in your table design, do the following:
`
`1. Select the field you want to use as a primary key by clicking on the row selector but(cid:173)
`ton to the left of the field name. Or if you want to select multiple fields, hold down
`the Ctrl key and click on the row selector for each field you want to define.
`2. Click on the Primary Key toolbar button (shown at left). Or choose Edit)>- Primary
`Key from the menu bar. Or right-click on the highlighted row selector and choose
`Primary Key.
`
`The field(s) you've set as the primary key will have a key icon in the row selector as
`shown below.
`
`If you change your mind about assigning a field as a primary key, just repeat the two
`steps above.
`
`Defining Indexes
`
`You can add an index to a field as a way to speed up sorting and searching on that field.
`Not all data types can be indexed, but any field that has a property named Indexed at
`the bottom of the General field properties tab is a candidate for indexing. Each table in
`your database can have up to 32 indexes.
`Be aware that indexes can slow down data entry and editing a little because Access
`must update the index whenever you add or change data. So you should index only the
`
`
`
`CREATING A TABLE WITHOUT USING A WIZARD
`
`169
`
`If the field's data type allows it, the field isn't a primary key, and the field name
`starts or ends with /0, key, code, or num, Access will create a Yes (No Duplicates)
`index automatically. To specify which field names will trigger an automatic index,
`choose Tools ~ Options, click on the Tables/Queries tab, and then edit or replace
`text in the Autolndex On Import/Create box. See Chapter 15 for more details.
`
`field(s) that you're most likely to use for sorting and searching. (To save you time and
`trouble, the Database Wizard and Table Wizard set up indexes on appropriate table
`fields automatically.)
`To add or remove an index on a field:
`
`I. Click on the name of the field you want to work with.
`2. Click on the General tab under Field Properties.
`3. Click on the Indexed property if it's available, click on the drop-down arrow next
`to Indexed, and then click on one of these options:
`
`No
`Rroq~.Wsd
`AllowZa;o ~ No
`tiD
`lnd&•ed
`
`When defining a field as an index, be sure to choose Yes (Duplicates OK)-rather
`than Yes (No Duplicates)-unless you're absolutely sure that no two records in the table
`should have identical values in that field. To remove an index from a field, set the
`Indexed property to No. You'll see examples of indexed fields later in this chapter.
`
`The primary key automatically gets an Indexed property of Yes (No Duplicates).
`You can't change that setting unless you remove the primary key on that field.
`
`You can view and change the index name, field name, sort order, and index prop(cid:173)
`erties for all the table's fields at once if you wish. To do so, choose View~ Indexes
`from the menu bar or click on the Indexes toolbar button (refer to Figure 6.2).
`
`5I
`IQ
`.0
`19
`tO
`0
`10
`C\
`.E
`....
`10
`f
`u
`
`
`
`170
`
`CHAPTER 6 • CREATING ACCESS TABLES
`
`Saving a Table Structure
`
`Once you're (reasonably) satisfied with the fields in your table, you can close and save
`the table structure. Here's how:
`
`1. Choose File~ Close from the menu bar or press Ctrl+W or click on the Close but(cid:173)
`ton in the table design window. You'll probably see a dialog box similar to this one:
`
`Microsolt Acceos
`
`EJ
`
`, \
`:..__£__.)
`
`[10 you want lo save change' to lhe design of table
`'CuS:tomeH;'?
`
`No
`
`Cancel
`
`2. Click on Yes.
`3. Type the name you want to assign to the table (up to 64 characters, including blank
`spaces) if you're prompted for a table name and then click on OK. If you haven't
`defined a primary key, you'll see this dialog box:
`
`Microsoft Access
`
`EJ
`
`!
`
`There is no primary key defined.
`
`Althc•ugh a primary koy isn't requi1ed. it's highly
`recommended, A t.able must have c primary key for
`}JOI l to define a relationship bel ween this table and
`other tables in the database
`
`Do.vou v-.1anl to create a primary kd}' nov-.1?
`
`Cancel
`
`4. Define a primary key. If you're not sure how to answer, we suggest that you click
`on Yes and let Access create a primary key for you. (Access will create a field named
`ID with the AutoN umber data type.) Your database usually runs faster if every table
`has a primary key.
`
`You'll be returned to the database window wh ere you can see the new table name on
`the Tables tab.
`
`
`
`OPENING A TABLE
`
`1171
`
`You can save the table structure without closing the table design window first. just
`click on the toolbar's Save button or press Ctri+S or choose File )1. Save anytime
`you're in the table design window. Access will save the changes you've made so
`far, and you'll remain in the table design window.
`
`When you save tables, forms, reports, queries, and other objects in your database,
`the database will increase in size. To make the current database smaller, you must
`compact the database. To get started, close the database, choose Tools )1. Data(cid:173)
`base Utilities )1. Compact Database, specify the database to compact from, and
`then choose a database name to compact to. See Chapter 1 7 for more details.
`
`Opening a Table
`
`After you've created a table, you can open it anytime:
`
`I. Click on the Tables tab in the database window.
`2. Click on the name of the table you want to open.
`
`• To open the table for entering or editing data, click on the Open button or
`double-click on the table name.
`• To view or change the table's design (structure), click on the Design button.
`
`You also can open or design a table by right-clicking on its name in the database
`window and then choosing Open or Design from the shortcut menu. The shortcut
`menu for tables also offers other handy options-Print, Print Preview, Cut, Copy, Save
`As/Export, Create Shortcut, Delete, Rename, and Properties. To find out the purpose of
`any option on the shortcut menu, point to that option with your mouse and look at the
`status bar for a brief description; then, if you need more details, press the Fl key.
`
`Switching between Design and Datasheet Views
`Once the table is open, you can switch quickly between datasheet view and design view.
`The differences between the two views are
`
`• In datasheet view you typically work with the table's contents (data). However, you
`also can make some changes to the table's structure (more about this in Chapter 8).
`• In design view you work with the table's structure only (field names, data types,
`properties), not with its contents.
`
`
`
`172
`
`CHAPTER 6 • CREATING ACCESS TABLES
`
`To switch views while a table is open, click on the View tool bar button:
`
`I~ Switch from datasheet view to design view
`Switch from design view to datasheet view
`I~ ~ ....
`
`~
`
`You also can switch to design or datasheet view by choosing View> Design View or
`View > Datasheet View from the menu bar. Or click on the drop-down arrow next to
`the View toolbar button and then choose Design View or Datasheet View.
`
`Why Two Views'!
`You will use datasheet view to add data to your table as explained in Chapter 8. Figure 6.3
`shows some names and addresses typed into a table named Customers. In datashect view,
`field names appear across the top of the table, and none of the underlying structural
`information (such as data types and properties) is visible. lf some fields are scrolled off th e
`right edge of the window, you can use the horizontal scroll bar at the bottom of the win(cid:173)
`dow to scroll left and right through the fields.
`
`*ildQ;IUM
`The Customers
`table in
`datash