Tải bản đầy đủ (.pdf) (56 trang)

how to do everything with microsoft office access 2003 phần 3 docx

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (2.15 MB, 56 trang )

HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 5
blind folio 89
Chapter 5
Enter and
Edit Data
P:\010Comp\HowTo8\938-1\ch05.vp
Thursday, August 07, 2003 6:45:11 PM
Color profile: Generic CMYK printer profile
Composite Default screen
How to…

Enter new data

Customize data entry

Change the datasheet appearance

Edit data in a table

Find and replace data
Once you have figured out how to distribute your data and built the tables to hold it, it’s time to
enter the data and get to work. In the last chapter, you saw some design features that keep errors
out of your database. This chapter discusses more tools that block data errors and speed up the
data entry process.
Enter New Data
When you open a new table, it appears in Datasheet view, ready for data entry. To add a new
record, click the New Record toolbar button or click the New Record navigation button. If you
prefer menus, choose Edit | Go To | New Record or Insert | New Record.
You can also simply scroll down to the blank record at the end of the table and
start typing.
When the insertion point moves to an empty field, type in the data. If you have specified a


custom display format, the entered value will adapt to that format when you move to the next
column. If you have created an input mask for that field, the mask appears when you enter the
field. See the section “Add Custom Input Masks” later in this chapter for details about input
masks and how they compare with display format settings.
You can enter date/time data in any valid format; Access will then convert it to the format
you’ve specified in the field property. However, do not try to enter decimal fractions in number
fields that are defined as integers because you will lose the decimal by the rounding off to the
integer equivalent.
Copy and Move Data
Access provides some shortcuts for entering repetitive data by copying or moving existing data.
You can copy or move all the data from one record to another or to individual fields or you can
move or copy specific items using the Edit menu or toolbar buttons. You also can display the
clipboard side pane and use it to copy and paste items:

Click Copy to add the selected item to the clipboard, then choose Edit | Copy or press
CTRL-C.
90 How to Do Everything with Microsoft Office Access 2003
HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 5
P:\010Comp\HowTo8\938-1\ch05.vp
Thursday, August 07, 2003 6:45:11 PM
Color profile: Generic CMYK printer profile
Composite Default screen
5
CHAPTER 5: Enter and Edit Data 91
HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 5

Click Cut to move the selected item to the clipboard, then choose Edit | Cut or press
CTRL-X.
When you collect items by copying or cutting them from their source, they are placed on
the Office clipboard, which is shared by all Office programs. The Office 2003 clipboard is a Task

pane that can hold up to 24 items with previews of the text or pictures that have been copied (see
Figure 5-1). You can paste them to a new location singly or as a group. If you place a 25th item
on the clipboard, the first item is deleted.
The first item on the Office clipboard is also on the Windows clipboard, and you can paste
it into almost any other Windows program. Similarly, cutting or copying from a non-Office
program puts an item on the Windows clipboard, and you can paste it into any Office program,
including Access.

To paste a selected item from the clipboard, place the insertion point where you want to
paste it and click Paste, choose Edit | Paste, or press
CTRL-V.
FIGURE 5-1 Copying items to the Office clipboard
P:\010Comp\HowTo8\938-1\ch05.vp
Thursday, August 07, 2003 6:45:12 PM
Color profile: Generic CMYK printer profile
Composite Default screen

To delete an item from the clipboard, move the mouse pointer to the item, then click
the down arrow to the right of the item and choose Delete from the menu.

To close the clipboard side pane, click the Close button in the upper-right corner.

To display the clipboard later, choose Edit | Office Clipboard.
The Options button at the bottom of the clipboard gives you control over the behavior
of the clipboard. The options include Show Office Clipboard Automatically, Show Office
Clipboard When Control-C Pressed Twice, Collect Without Showing Office Clipboard,
Show Office Clipboard Icon On Taskbar, and Show Status Near Taskbar When Copying.
Copy and Move Within the Same Table
You can copy or move one or more records within the same table. Once you copy a record, you
can add it to the table or replace an existing record with the one you copied.

To copy a record within the same table:
1. Select the record you want to copy by clicking the record selector (the small gray button
to the left of the record).
2. Click the Copy toolbar button or choose Edit | Copy (or press
CTRL-C).
3. Click the record selector in the record you want to replace and click Paste (or press
CTRL-V).
4. If you want to add the copy as a new record rather than replace an existing one, select
the empty record at the bottom of the datasheet, then click Paste (or press
CTRL-V).
Access tries to save the copied record when you move out of it. If the table has a
primary key or a unique index, Access won’t let you leave the new record until you
have replaced the duplicate value with a unique one. If the primary key field is an
AutoNumber data type, Access automatically increments the number rather than
copying the original number—another good reason to use an AutoNumber field
as the primary key.
To copy more than one record:
1. Select all the records you want to copy before clicking Copy.
2. When replacing records, select the same number of existing records as you have placed
on the clipboard, then click Paste.
3. To append the new records to the table instead of replacing existing ones, select the new
empty row at the bottom of the datasheet and click choose Edit | Paste Append.
Access asks for confirmation when you try to paste multiple records.
If the table has a primary key or a unique index that is not an AutoNumber, you will not be
able to paste multiple records until you remove the key or index. Access would have to save all
92 How to Do Everything with Microsoft Office Access 2003
HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 5
P:\010Comp\HowTo8\938-1\ch05.vp
Thursday, August 07, 2003 6:45:12 PM
Color profile: Generic CMYK printer profile

Composite Default screen
5
CHAPTER 5: Enter and Edit Data 93
HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 5
but one of the records, rather than paste a single record, and this would create duplicate values in
the field. If you try, Access objects by displaying the information message shown here.
If you just want to repeat the value in a single field to the next record while you are
entering data in a new record, you can quickly copy the value by pressing
CTRL-’
(apostrophe) after moving to the field.
If you want to move one or more records rather than create another copy of the data in the
record, click Cut instead of Copy. This removes the record completely and places it on the clipboard.
Then use the same paste or append process as described previously for copying records.
Copy and Move from Another Table
If you want to copy or move records from another table, select the records in the source table
and click Copy or Cut. (If you click Cut, you will be asked to confirm that you wish to delete
the record or records from the source table.) Switch to the destination datasheet and select the
blank row at the bottom of the datasheet. When you click Paste, the new records are added to
the destination datasheet.
The fields in the copied records are pasted in the same order as they appeared in the
original datasheet, regardless of the field names. You might need to rearrange the columns
in the destination datasheet before pasting so they will correspond with the incoming
fields. Inconsistent data types or sizes between the incoming and the destination records
can result in problems.
If you want to replace certain records in the destination datasheet with records from another
table, select the records you want to replace before clicking Paste. To append records from
another table to the existing datasheet, choose Edit | Paste Append. If the source table has more
fields than the destination table, the excess fields are not pasted.
Insert Pictures
The Home Tech Repair Employees table has a field reserved for the employees’ badge pictures.

The Badge Picture field is an OLE (Object Linking and Embedding) Object data type and will
store a file containing the digitized photograph. The Badge Picture photos are OLE Objects
created by a scanner and contained in image files such as .tif, .gif, or .pcx. Because the photos
P:\010Comp\HowTo8\938-1\ch05.vp
Thursday, August 07, 2003 6:45:13 PM
Color profile: Generic CMYK printer profile
Composite Default screen
are not expected to change, they are embedded in the table. Additionally, they represent the
value stored in the Badge Picture field, which means they are bound to the table records.
Objects you expect to be edited often are better left in the source program and linked to
your table. You can store the pathname or filename of the picture or other object in the
Text field and won’t have to reimport it when changes occur.
To insert an image in the Badge Picture field:
1. Place the insertion point in the Badge Picture field and choose Insert | Object,
or right-click the field and choose Insert Object from the shortcut menu.
2. In the Insert Object dialog box, choose Create from File.
94 How to Do Everything with Microsoft Office Access 2003
HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 5
Fix Paste Problems
When errors occur during a paste operation, Access creates a Paste Errors table and displays
a message advising you of the errors as each is added to the table.
To view the Paste Errors table, double-click the table name in the Tables page of the Database
window. When you open the Paste Errors table, you might be able to paste the data in the
destination table field by field.
Here are some of the problems you might encounter when trying to paste data into
a datasheet:

Values are incompatible with the destination data types.

The value is too long for the destination field.


The destination is in a hidden column.

A value violates one of the destination field property settings.
P:\010Comp\HowTo8\938-1\ch05.vp
Thursday, August 07, 2003 6:45:14 PM
Color profile: Generic CMYK printer profile
Composite Default screen
5
3. Type the path and filename of the image file in the File box or click Browse and look for
the object.
4. Choose OK to embed the picture in the field.
When you return to Datasheet view, the field now contains the name of the source of the
OLE object. To see the image, create a form by clicking New Object: AutoForm. Figure 5-2
shows an Employee record with the badge picture embedded.
CHAPTER 5: Enter and Edit Data 95
HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 5
FIGURE 5-2 The employee’s badge picture inserted
P:\010Comp\HowTo8\938-1\ch05.vp
Thursday, August 07, 2003 6:45:14 PM
Color profile: Generic CMYK printer profile
Composite Default screen
96 How to Do Everything with Microsoft Office Access 2003
HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 5
You might need to double-click the added object to activate the OLE source program
associated with that type of file before you can see the image.
Insert Hyperlinks
A hyperlink is a connection to an object in the same or another Access database, a document created
in another program, a document on the Internet, or your local intranet. The hyperlink field contains
the address of the target object, and when you click the hyperlink, you jump to it. If the object

is the product of another application, that application is automatically started.
In the Home Tech Repair database, the Workorders table contains a hyperlink field that
contains the engineering drawings for that work order. The scanned drawings are saved as .gif
files in the same folder as the database itself.
Define the Hyperlink Address
A hyperlink address can contain up to four parts, separated by the pound sign (#), as in
displaytext#address#subaddress#screentip, of which only the address is required. If you want
the hyperlink to jump to a specific location in the target object, a subaddress is also required.

The displaytext is optional and can be displayed in the field in place of the actual address.
If you don’t include display text, the hyperlink address or subaddress appears instead.
■ The address is either a Uniform Resource Locator (URL) such as a web address, or
Universal Naming Convention (UNC) path to the document. An absolute path starts
with \\ and describes the exact location on the system or local area network (LAN).
A relative path is related to the current path or the base path specified in the database
properties. An address is required unless you added a subaddress that points to an object
in the current database.

The subaddress contains a named location within the target object, such as a bookmark
in a Word document, a particular slide in a PowerPoint presentation, or a cell range in
an Excel spreadsheet.

The screentip is the text that appears when you rest the mouse pointer on the hyperlink.
If you don’t specify a ScreenTip, the address is displayed.
The scanned drawings for the Workorders Drawing field are stored in the Home Tech folder
with the database. To use the Insert Hyperlink tool to enter the hyperlink address:
1. Place the insertion point in the Drawing field in the Workorders datasheet.
2. Click Insert Hyperlink or choose Insert | Hyperlink (see Figure 5-3).
3. Click the Existing File or Web Page button under Link to: if not already chosen.
Then do one of the following:

P:\010Comp\HowTo8\938-1\ch05.vp
Thursday, August 07, 2003 6:45:14 PM
Color profile: Generic CMYK printer profile
Composite Default screen
5

Type the path to the drawing file in the Address box; for example,
c:\My Documents\Osborne\fireplace.gif.

If you have accessed the target of this hyperlink before, you can select it from the
list of Recent Files or Browsed Pages.

Click the Browse for File button (the open folder) and locate the file in the Link to
File dialog box and click OK.
4. Enter the text you want to show in the field in place of the address in the “Text to display”
box. For example, you could enter Fireplace.
5. If you want to show a ScreenTip, click the ScreenTip button and enter the text in the Set
Hyperlink ScreenTip dialog box, then click OK.
CHAPTER 5: Enter and Edit Data 97
HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 5
FIGURE 5-3 The Insert Hyperlink dialog box
Move up one folder
Browse the Web
Browse for file
P:\010Comp\HowTo8\938-1\ch05.vp
Thursday, August 07, 2003 6:45:15 PM
Color profile: Generic CMYK printer profile
Composite Default screen
98 How to Do Everything with Microsoft Office Access 2003
HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 5

6. Click OK to finish inserting the hyperlink and return to the Workorders datasheet where
the hyperlink appears in the Drawing field. When you rest the mouse pointer on the
hyperlink, you will see the ScreenTip.
7. Click the hyperlink to test it; Microsoft Picture Library (or whatever program handles
your .gif files) opens, displaying the scanned fireplace drawing, as shown in Figure 5-4.
Edit and Delete Hyperlinks
Editing a hyperlink address is a little different from editing normal text because if you click on
the address, you jump to the target. There are two ways to edit the address:

Right-click the hyperlink, point to Hyperlink in the shortcut menu, and click Edit
Hyperlink in the submenu; edit the address directly in the Edit Hyperlink dialog box.
FIGURE 5-4 The target of the fireplace hyperlink
P:\010Comp\HowTo8\938-1\ch05.vp
Thursday, August 07, 2003 6:45:15 PM
Color profile: Generic CMYK printer profile
Composite Default screen
5
CHAPTER 5: Enter and Edit Data 99
HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 5

Press TAB to move to the field and press F2 to switch to Edit mode.
An easier way to change only the displayed text is to right-click the hyperlink, choose
Hyperlink | Display Text, and edit the text in the box.
To delete a hyperlink from a field, right-click the hyperlink and choose Cut from the shortcut
menu. You can also point to Hyperlink in the shortcut menu and click Remove Hyperlink. If you
want to delete all the hyperlink addresses you have inserted in a field, delete the field from the
table design.
Customize Data Entry
Access offers many tools that help improve the efficiency and accuracy of data entry. Some
minimize the process, others assist in navigation in a datasheet or give you access to special

symbols. For example, input masks guide the user with data input and help to prevent data
errors, and lookup fields offer a list of valid values for selection.
Add Custom Input Masks
An input mask is a field property similar to the Format property but with a different purpose. An
input mask displays a fill-in blank for data entry whereas a format is used to display field data
with a consistent appearance. Setting the Format property affects how data is displayed after it
is entered and offers no control over or guidance for the data being entered. Input masks can be
used with Text, Number, Date/Time, and Currency fields. An Input Mask Wizard can help you
with Text and Date/Time fields.
To decide between a Format property and an Input Mask property, use the following guidelines:

If you just want to make sure the field values look the same when displayed, use the
Format property to specify the desired appearance.

If you want to guide data entry and make sure it is entered properly, use an input mask.
An input mask appears before any data is entered, when the insertion point reaches the field.
The mask displays fill-in blanks with literal characters separating them. When you use an input
mask, you can be sure the data will fit the specifications you set by limiting the number of fill-in
spaces. Depending on the characters you use in the mask, you can leave some fill-in spaces blank
but you cannot enter more characters than there are spaces.
To create an input mask with the Input Mask Wizard:
1. Move the insertion point to the field in the table Design view.
2. Click in the Input Mask property, then click the Build button (…).
3. Select a mask in the Input Mask Wizard dialog box, as shown in Figure 5-5, and
click Next.
4. You can make changes to the mask, such as changing the placeholder that displays as
the fill-in blanks (the default is an underline character). Then click Next.
P:\010Comp\HowTo8\938-1\ch05.vp
Thursday, August 07, 2003 6:45:15 PM
Color profile: Generic CMYK printer profile

Composite Default screen
100 How to Do Everything with Microsoft Office Access 2003
HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 5
5. Choose to store the literal characters with the data, if desired, by adding them to the
Input Mask text box. This uses more disk space but the symbols are already available
when you want to use the value in a form or report.
6. Click Finish to close the wizard.
If you have a customized field that is not part of the Input Mask Wizard’s repertoire, you can
easily create your own mask manually using special symbols. The special symbols are placeholders
that specify which entries are required and define what type of characters can be entered at each
position in the mask. You can even add a custom mask to the wizard’s list of predefined input
FIGURE 5-5 Predesigned input masks
Input mask for
Phone Number field
P:\010Comp\HowTo8\938-1\ch05.vp
Thursday, August 07, 2003 6:45:16 PM
Color profile: Generic CMYK printer profile
Composite Default screen
5
masks. You cannot create an input mask for a Memo, AutoNumber, Yes/No, OLE Object, or
Hyperlink field.
To build an input mask manually, enter the desired characters directly in the field’s Input
Mask property in Design view. Table 5-1 describes the symbols you can use in an input mask
and indicates whether they will require an entry in that position.
Here are some examples of the effects of input masks:
Input Mask Description Sample Valid Value
00000-9999 Uses zeros to represent required entries. The 9s are
optional.
92118-2450 or 92118-
(999) AAA-AAAA Allows letters or digits. The area code is optional. (301) 555-CALL

!>L0L 0L0 Converts all letters to uppercase, and fills the mask
from left to right.
N0C 1H0
>L<?????????? Converts required initial letter to uppercase. Other
characters are optional and converted to lowercase.
Henrietta
>LL0000-000 Converts the two required letters to uppercase, which
are followed by the seven required digits.
BT5430-115
To make a change in one of the wizard’s masks, select the mask first in the Input Mask
Wizard dialog box, then click Edit List and proceed as in the preceding examples to make the
desired changes.
CHAPTER 5: Enter and Edit Data 101
HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 5
Symbol Entry Entry Required?
0 Displays a digit (0 through 9) with no + or – sign. Blanks display as zeros. Yes
9 Displays a digit with no + or – sign. Blanks display as spaces. No
# Displays a digit with + and – signs. Blanks display as spaces. No
L Displays a letter (A through Z). Yes
? Displays a letter. No
A Displays a letter or digit. Yes
a Displays a letter or digit. No
& Displays any character or space. Yes
C Displays any character or space. No
< Converts letter to lowercase. N/A
> Converts letter to uppercase. N/A
! Fills the mask with the characters that the user types into the mask, from
left to right. Can appear anywhere in the mask.
N/A
\ Treats the next character as a literal. N/A

TABLE 5-1 Input Mask Symbols
P:\010Comp\HowTo8\938-1\ch05.vp
Thursday, August 07, 2003 6:45:16 PM
Color profile: Generic CMYK printer profile
Composite Default screen
102 How to Do Everything with Microsoft Office Access 2003
HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 5
Create a Custom Input Mask
If you have a field that commonly appears in your tables or forms, such as the Canadian
postal code, you can create a new input mask and save it in the Input Mask Wizard’s list
of predefined masks, as follows:
1. In table Design view, click the Input Mask property for the field, then click the
Build button to open the Input Mask Wizard dialog box.
2. Click Edit List. The Customize Input Mask Wizard dialog box shows the Phone
Number input mask.
3. Click the New Record navigation button at the bottom of the dialog box to show
a blank form.
4. Enter a description of the new mask, the mask itself, the symbol you want to use
as the placeholder, and a sample of the data you intend to enter into the field.
5. Select the Text/Unbound Mask Type. The definition for the Canadian postal code
input mask is complete.
6. Click Close. The new definition appears in the list of predefined masks.
P:\010Comp\HowTo8\938-1\ch05.vp
Thursday, August 07, 2003 6:45:17 PM
Color profile: Generic CMYK printer profile
Composite Default screen
5
CHAPTER 5: Enter and Edit Data 103
HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 5
Create Lookup Fields

A lookup field is an Access tool that makes entering data quicker and more accurate. A lookup
field displays a list of values from which to choose. The most common type of lookup field,
called a lookup list, gets its values from an existing table or query. The advantage of this type
of lookup field is that the tables actually are related and as the source list changes, the current
values are available to the lookup field.
The second type of lookup field gets its values from a list that you type in when you create
the field. This type is called a value list and is best used when the list is limited to a few values
that do not change often, such as a short list of product categories or employee status.
You can add either type of lookup field in Design or Datasheet view. If the field already
exists in the table design and you want to change it to a lookup field, you must change the
data type in Design view. To add a new lookup field to a table, do one of the following:

In Design view, add a new field row and select Lookup Wizard from the Data Type list.

In Datasheet view, click in the column to the right of where you want the new lookup
field, then choose Insert | Lookup Column.
Both methods start the Lookup Wizard, which displays a series of dialog boxes where you
specify the details of the lookup field. In the first dialog box, decide which type of lookup field
to create: a lookup list that relates to a table or query, or a value list that you type in.
Specify a Lookup Column
As an example of defining a lookup field that gets its values from another table, let’s insert a new
field in the Workorders table of the Home Tech Repair database. The Workorders information is
easier to enter and read if a lookup field is used for the Supervisor, Principal Worker, and Helper
fields. The Last Name will be displayed, but the Employee ID will be stored.
To add a lookup field to the Workorders table:
1. Open the Workorders table in Design view and insert a field named Supervisor between
Completion Date and Principal Worker, choosing the Lookup Wizard data type.
2. In the first Lookup Wizard dialog box, choose the first option, “I want the lookup
column to look up the values in a table or query.” Click Next.
3. Select Employees from the list of tables and click Next. You could also select a query

as the source of the values.
4. In the next dialog box, double-click the Employee ID and Last Name fields in the list
of available fields in the Employees table (see Figure 5-6). Click Next.
5. In the next dialog box, you can specify the sort order for the fields in the lookup list.
Click Next.
6. The next dialog box (see Figure 5-7) shows you how the field values will look in the
lookup column. Drag the right edge of the column header to adjust the width if necessary.
Also check the “Hide key column (recommended)” option so you need not view the
Employee ID key value, only the last name. If you have no data in the column yet,
accept the default column width. Click Next.
P:\010Comp\HowTo8\938-1\ch05.vp
Thursday, August 07, 2003 6:45:17 PM
Color profile: Generic CMYK printer profile
Composite Default screen
7. Accept the name Supervisor for the lookup column and click Finish. Access prompts
you to save the table so that the relationships can be completed.
104 How to Do Everything with Microsoft Office Access 2003
HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 5
FIGURE 5-6 Selecting the fields for the lookup field
FIGURE 5-7 Changing the lookup column appearance
P:\010Comp\HowTo8\938-1\ch05.vp
Thursday, August 07, 2003 6:45:17 PM
Color profile: Generic CMYK printer profile
Composite Default screen
5
8. Choose Yes. Access returns you to the table Design view.
The Lookup Wizard has set the properties for the new field based on your selections in the
dialog boxes, which you can view on the Lookup tab of the Field Properties pane.
Take a look at the Lookup properties that specify the appearance and behavior of the lookup
field when it appears in a datasheet or a form. As you click in each property on the Lookup tab,

look at the description in the right pane.
The Workorders table shows the new lookup field used to locate employee names in
the Employee table. The lookup field links the Employee table to the Workorders table
by the Employee ID field. The employee’s last name is displayed; the foreign key (Employee
ID) is not displayed but it is stored in the field.
Specify a Lookup List
A list of acceptable values can be helpful when entering data in the Employees table. Because
only a few values are valid in the Specialty field, it is a good candidate for streamlining. Start
with the Lookup Wizard as before, and in the first Lookup Wizard dialog box, choose the second
CHAPTER 5: Enter and Edit Data 105
HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 5
P:\010Comp\HowTo8\938-1\ch05.vp
Thursday, August 07, 2003 6:45:17 PM
Color profile: Generic CMYK printer profile
Composite Default screen
106 How to Do Everything with Microsoft Office Access 2003
HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 5
option “I will type in the values I want.” Then move to the next dialog box, shown here, where
you enter the values for the list.
The Row Source property on the Lookup tab for the Specialty field now shows the list of
values you typed in instead of a SELECT statement.
Change the Datasheet Appearance
Datasheet properties include the layout of the fields and records—the order in which the fields
appear, the dimension of the rows and columns, and the column headings. Other properties are
the font size and style, the colors of the text, the background, and special cell effects such as
raised or sunken.
You also have the option of hiding some fields from view if the data shouldn’t be visible to
all users of the database. Finally, if you have too many fields to view on the screen at once, you
can keep one or more key fields on the left of the screen as you scroll right so some information
is always in view.

All of these changes in datasheet appearance also can be applied to subdatasheets.
Move and Resize Columns and Rows
Access displays the data fields in columns in the same order as the fields appear in the table
design unless you change the column order. By default, the columns are all the same width,
so you might not be able to see the whole field name or value. Other columns might be wider
P:\010Comp\HowTo8\938-1\ch05.vp
Thursday, August 07, 2003 6:45:18 PM
Color profile: Generic CMYK printer profile
Composite Default screen
5
than necessary and waste screen space. The rows also are standard height. You can change
any of these datasheet properties using the elements of the datasheet itself.
Rearrange the Columns
To move a column, click the field selector, release the button, and move the mouse pointer to the
field selector. When the mouse pointer changes shape to an arrow with a small rectangle, click
and drag the column to the desired position.
As you move the column, a dark vertical line moves with it, showing you where the left
boundary of the moving column is at that moment. Release the mouse button to reposition the
column. Changing the relative position of a column in the datasheet has no effect on the way
the fields appear in the table design or the way they are stored on the disk.
Change the Column Width
There are three ways to change a column width:

Drag the sizing line at the right border of the field selector button

Double-click the column sizing line to fit the contents

Set the precise width in a dialog box
If you drag the boundary all the way left until it reaches the left boundary, the column
disappears. This is one way to hide a column. You will learn more about hiding columns

in the section “Freeze and Hide Columns.”
If you need to specify a column width more precisely, you can set the exact width in the
Column Width dialog box after selecting one or more columns:
1. Select one or more columns.
2. Choose Format | Column Width or right-click the field selector and choose Column
Width from the shortcut menu.
CHAPTER 5: Enter and Edit Data 107
HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 5
Row sizing lines
Field selectors
Column sizing lines
P:\010Comp\HowTo8\938-1\ch05.vp
Thursday, August 07, 2003 6:45:18 PM
Color profile: Generic CMYK printer profile
Composite Default screen
3. Type a new value in the Column Width text box or click Best Fit. The Best Fit option
resizes the selected column or columns to fit the longest data string currently in the field
or the text in the column heading, whichever is longer.
Change the Row Height
You can change column widths individually; however, rows are all the same height, thus when
you change the height of one, you change them all.
To change the row height:
1. Move the mouse pointer to any one of the row sizing lines in the record selector area.
2. Click and drag the line until the rows reach the desired height.
3. Release the button. All rows will be the same height.
To set a more exact row height, choose Format | Row Height to open the Row Height dialog
box. (The insertion point can be anywhere in the datasheet.) You also can right-click in a selected
row or a row selector and choose Row Height from the shortcut menu. The Row Height dialog
box is similar to the Column Width dialog box except there is no Best Fit option. The height is
measured in points; the default height depends on the default font size.

Freeze and Hide Columns
Two other properties of a datasheet deal with the display of the data. Freezing a column keeps the
data on the screen as you scroll right to see other fields in a long record. Hiding a column keeps
the data from displaying in the datasheet. Again, neither of these properties changes the way the
data is stored, only the way it is displayed.
Freeze and Unfreeze Columns
When you freeze a column on the screen, the column and its contents are automatically moved to
the left of the datasheet and kept on the screen as you scroll right.
To freeze a column:
1. Place the insertion point anywhere in the column you want to freeze.
2. Choose Format | Freeze Columns, or right-click in the column header and choose
Freeze Columns from the shortcut menu.
108 How to Do Everything with Microsoft Office Access 2003
HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 5
P:\010Comp\HowTo8\938-1\ch05.vp
Thursday, August 07, 2003 6:45:18 PM
Color profile: Generic CMYK printer profile
Composite Default screen
5
To freeze several adjacent columns, select them all before choosing Freeze Columns. If you
want to freeze non-adjacent columns, freeze them one at a time in the order you want them to
appear at the left of the screen. Access will move them one by one to the left side of the datasheet.
To unfreeze the columns, choose Format | Unfreeze All Columns.
Unfortunately, Access doesn’t return the thawed column to the position it was in before
you froze it and moved it to the left. You have to move it back yourself or close the table
without saving the changes in the layout to restore the original arrangement.
Hide and Unhide Columns
If your table contains information that is not relevant to the current activity, you might not want it
to take up space on the screen. In this case, you can hide one or more columns from view. Again,
this changes only the appearance of the datasheet, not the data that is stored in the table. To hide

a column, place the insertion point anywhere in the column, then choose Format | Hide Columns.
You can also right-click in a selected column or in the field selector and choose Hide
Columns from the shortcut menu. The column immediately disappears from the screen. If you
want to hide several adjacent columns, select them all first. If you want to hide non-adjacent
columns, reposition them so they are adjacent, then hide them as a group or one at a time.
If you try to copy or move records to a datasheet that currently has hidden columns, the
data will not be entered and you will get paste errors. Be sure to unhide all the hidden
columns before attempting to copy or move records.
To return the hidden columns to the datasheet display, choose Format | Unhide Columns. The
Unhide Columns dialog box appears with a list of all the fields in the datasheet. Check marks next
to the field names indicate the fields currently in view. If a field does not show a check mark, it is
currently hidden. To return a field to the datasheet display, check the box next to its name. Choose
Close when you have returned all the desired fields to the display.
While you are unhiding columns with the Unhide Columns dialog box, you can hide
columns at the same time by removing the check marks next to the columns you want
to hide.
Change the Font
Access uses 10-point Arial as the default font for datasheets. The font setting applies to all the
characters in the datasheet—data and captions alike. You might want to reduce the font size to
get more data on the screen or enlarge it to make it more visible if a group will be viewing the
screen from a short distance. The row height and column widths are automatically adjusted to
accommodate the font changes.
To change the datasheet font, choose Font from the Format or shortcut menu to open the
Font dialog box (see Figure 5-8). Select the font, size, and effects you want, then click OK.
CHAPTER 5: Enter and Edit Data 109
HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 5
P:\010Comp\HowTo8\938-1\ch05.vp
Thursday, August 07, 2003 6:45:19 PM
Color profile: Generic CMYK printer profile
Composite Default screen

110 How to Do Everything with Microsoft Office Access 2003
HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 5
You can use the Formatting (Datasheet) toolbar buttons to change the font properties. You
also can use the Formatting toolbar to change the appearance of the datasheet gridlines and cells.
Any changes you make affect the entire datasheet.
Change Grid Lines and Cell Appearance
Now comes the fun part: making some dramatic changes to the appearance of the datasheet with
colors and special effects. The grid lines—the horizontal and vertical lines that separate the datasheet
into rows and columns—are displayed by default, but you can remove the horizontal or vertical
lines, or both. The cells are the boxes at the intersection of the rows and columns. In addition to
changing the appearance of the grid lines, you can apply special effects to the cells to make them
appear raised or sunken.
To change the datasheet properties, choose Format | Datasheet. The Datasheet Formatting
dialog box opens, as shown in Figure 5-9.
FIGURE 5-8 The Font dialog box
Bold
Italic
Underline
Fill/Back Color
Font/Fore Color
Line/Border Color
Gridlines
Special Effect
Font Size
Font
P:\010Comp\HowTo8\938-1\ch05.vp
Thursday, August 07, 2003 6:45:20 PM
Color profile: Generic CMYK printer profile
Composite Default screen
5

CHAPTER 5: Enter and Edit Data 111
HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 5
In the Datasheet Formatting dialog box, you can make the following changes; as you make
changes, the combined effects are shown in the Sample panel:

Set a special cell effect, such as Raised or Sunken

Show or hide the horizontal and vertical gridlines

Change the color of the grid lines and the cell background

Change the style of the borders and grid lines to weights ranging from transparent to
double-solid

Change the column display direction from left-to-right (the first field appears in the first
column, the second in the column to the right, and so on) to right-to-left (the first field
appears in the rightmost column, the second in the column to the left, and so on)
Set Datasheet Default Options
To save the new datasheet appearance, save the layout with the table. To create a custom datasheet
layout for use with all the tables in the database, change some of the default datasheet options.
Choose Tools | Options to open the Options dialog box, then click the Datasheet tab. The same
formatting options from the Datasheet Formatting dialog box are available in the Options dialog
box in addition to Show Animations, which turns on the animation features, such as the columns
sliding over to make room when you insert a new column. There is also an option to show Smart
Tags on the datasheet, which, when checked, displays a purple dotted line under text to indicate a
Smart Tag.
FIGURE 5-9 The Datasheet Formatting dialog box
P:\010Comp\HowTo8\938-1\ch05.vp
Thursday, August 07, 2003 6:45:20 PM
Color profile: Generic CMYK printer profile

Composite Default screen
Change Table Definition in Datasheet View
Although the best place to modify the table definition is in Design view, you can make some
limited changes in Datasheet view. You can insert or delete the subdatasheets that display records
from related tables, add or delete columns, and change field names in Datasheet view.
Insert/Delete a Subdatasheet
You can use the Insert menu to add a subdatasheet to a table.
To insert or delete a subdatasheet:
1. Open the table or query in Datasheet view.
2. Choose Insert | Subdatasheet. The Insert Subdatasheet dialog box opens showing
three tabs: Tables, Queries, and Both.
3. Click the tab that contains the datasheet you want to use for the subdatasheet.
4. Select the table or query name in the list.
5. Choose the foreign key field for the subdatasheet table or query in the Link Child
Fields box.
6. Choose the primary key or matching field for the open datasheet in the Link Master
Fields box and click OK.
To remove a subdatasheet from a table or query, open the table or query in Datasheet view
and choose Format | Subdatasheet | Remove. The subdatasheet is removed only from the display.
The data is not affected and the relationship remains intact.
112 How to Do Everything with Microsoft Office Access 2003
HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 5
P:\010Comp\HowTo8\938-1\ch05.vp
Thursday, August 07, 2003 6:45:20 PM
Color profile: Generic CMYK printer profile
Composite Default screen
5
Insert/Delete a Column
To insert a column in the datasheet, place the insertion point in the column to the right of where
you want the new one, then choose Insert | Column. A new blank column appears and the columns

to the right move over. Double-click the field selector, usually labeled Field1, and rename the
column with the appropriate field name.
If you want to change the data type that Access assumes for the field, define a validation
rule, or change other properties, you must switch to Design view.
As discussed earlier in this chapter, the Insert menu offers two special columns: Lookup and
Hyperlink. If you choose Lookup Column, the Lookup Wizard starts. Choosing Hyperlink Column
inserts a new blank column, but the field is automatically specified as the Hyperlink data type.
To delete a column in Datasheet view, click anywhere in the field and choose Edit | Delete
Column. Access warns you that the deletion will be permanent. This is one of those cases where
Undo doesn’t work. Choose Yes to go ahead with the deletion or No to cancel. You can delete
only one column at a time in Datasheet view.
You cannot delete a field that is part of a relationship without first deleting the relationship.
Either open the Relationships window to delete the relationship or accept Access’s offer
to delete it for you.
Change Field Names
In Datasheet view, you have three ways to rename an existing column. All three methods place
the insertion point in the field name text, where you can replace or edit the existing name. Be
warned that this also deletes the caption you might have specified:

Double-click the text in the field selector and type the new name.

Select the column and choose Format | Rename Column.

Right-click the field selector and choose Rename Column from the shortcut menu.
Edit Record Data
You can use the Edit | Go To submenu or the navigation buttons at the bottom of the datasheet or
form to move to another record: Next, Previous, First, Last, or New. The
TAB key and the RIGHT
ARROW
and LEFT ARROW keys move to another field.

All the Office Spelling and AutoCorrect features are available to you in Access. You can
use these tools to help with Text and Memo field data.
When the table contains many fields, some of them are not always visible. Instead of scrolling
right and left to enter data in long records, you can use the Go To Field box on the Formatting
(Datasheet) toolbar, which contains a list of all the fields in the current datasheet. Click the arrow
CHAPTER 5: Enter and Edit Data 113
HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 5
P:\010Comp\HowTo8\938-1\ch05.vp
Thursday, August 07, 2003 6:45:21 PM
Color profile: Generic CMYK printer profile
Composite Default screen

×