📄 ch02.htm
字号:
</BLOCKQUOTE>
<H2><FONT COLOR="#000077"><B>Database: Documentor</B></FONT></H2>
<P>Data documentation can help you get organized, especially for large <I>databases</I>.
Database dictionaries describe the database as a whole, each <I>table</I>, and each
<I>field</I>. Access has a Database Documentor that describes these and other parts
of your database for you.
<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
<DL>
<DD><B>1. </B>From your open database, choose <U>T</U>ools, Analy<U> </U>ze, <U>D</U>ocumentor.
<P>
<DD><B>2. </B>When the Documentor <I>dialog box</I> opens, select which objects you
want to document by choosing the <I>Object</I> <U>T</U>ype drop down and clicking
the <I>check boxes</I> next to each item in the <U>O</U>bjects list.
<P>
<DD>If you want to document everything (which can take a while), click the All Object
Types tab and choose the Select <U>A</U>ll <I>command button</I>.
<P>
<DD><B>3. </B>When you are finished choosing the objects, choose OK. A preview of
your documentation <I>report</I> appears on-screen. Print your report if desired.
<P>
<DD><B>4. </B>If you want to save the documentation information into a table, choose
<U>F</U>ile, Save <U>A</U>s Table.
</DL>
<H2><FONT COLOR="#000077"><B>Database: Examples</B></FONT></H2>
<P>One of the best ways to learn Access and find ideas for your own databases is
to look at the samples that come with the program. These sample databases might have
been installed when you set up Microsoft Office. If not, you will need to go through
setup. The files are Northwind, Orders, and Solutions. The first <I>database</I>
you should look at is Northwind. Orders and Solutions provide examples for application
development and programming.
<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
<DL>
<DD><B>1.</B> To open a sample database, click the Open Database button on the toolbar.
<P>
<DD><B>2. </B>Change the Look In drop-down box to the Samples subfolder of the folder
where the Office directory is installed.
<P>
<DD><B>3.</B> Double-click Northwind, Orders, or Solutions.
</DL>
<BLOCKQUOTE>
<P>
<HR>
<FONT COLOR="#000077"><B>NOTE:</B></FONT><B> </B>The Northwind database includes
a Show Me menu that explains features of the application. Orders and Solutions have
a Show Me button on their toolbars.
<HR>
</BLOCKQUOTE>
<H2><FONT COLOR="#000077"><B>Datasheet: Appearance Change</B></FONT></H2>
<P>There are numerous ways you can alter the appearance of your datasheet. You must
have the datasheet for that <I>table</I> in view; these settings apply universally
to the table, and not to individual cells. You can modify a table datasheet, <I>query</I>
datasheet, or the <I>Form View</I> of a form.
<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
<DL>
<DD><B>1. </B>Double-click the table or query name in the <I>Database window</I>
to open its datasheet; or click the View button drop-down arrow and choose <I>Data</I><CITE>s</CITE><I>heet
View</I> when a form is in view.
<P>
<DD><B>2. </B>Choose F<U>o</U>rmat, <U>F</U>ont to select a new font, font style,
font size, or color.
<P>
<DD><B>3. </B>Choose F<U>o</U>rmat, C<U>e</U>lls and change the gridline, gridline
color, cell appearance, and cell background color in the Cells Effects <I>dialog
box</I>.
<P>
<DD><B>4. </B>Click the Close box to close the datasheet.
<P>
<DD>Access remembers your settings the next time you open a datasheet for this <I>table</I>,
<I>query</I>, or <I>form</I>.
</DL>
<P>Additionally, you can change the width of a column or the height of all rows in
the datasheet using the F<U>o</U>rmat, Column Width (see "Width of Column"
in the Database Essentials part of this book) or F<U>o</U>rmat, <U>R</U>ow Height
commands. Each column can have its own width, but all rows must be the same size.
You can also hide (see "Hide Columns") or freeze (see "Freeze Display
of a Table Field" in the Database Essentials part of this book) columns to help
see the more of the datasheet.
<H2><FONT COLOR="#000077"><B>Datasheet: Appearance Defaults</B></FONT></H2>
<P>When you use the Format menu to change the datasheet appearance, only the viewable
datasheet changes. (See "Datasheet: Appearance Change.") You can also change
the appearance for all datasheets you have not individually changed.
<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
<DL>
<DD><B>1. </B>Choose <U>T</U>ools, <U>O</U>ptions, and click the Datasheet tab.
<P>
<DD><B>2. </B>Change any of the options for font, background, and <I>gridlines</I>;
choose OK.
</DL>
<H2><FONT COLOR="#000077"><B>Decimal Places</B></FONT></H2>
<P>Decimal places are basically the numbers after the decimal point (for example,
25 becomes 25.00 when you add two decimal places). When you work with numbers, having
all related numbers with the same number of decimal places adds to the professional
appearance of your output. Changing the number of decimal places only adds to the
visual appearance of a number, not to its value. Another option is to use the Rnd
(Round) <I>function</I>, which will change the value of a number. If you want to
add commas or other symbols with numbers, change the format <I>property.</I> (See
"Data: Format.")</P>
<P><I>Forms</I> and <I>reports</I> also enable you to change decimal places. On forms
and reports, you can change decimal places by right-clicking the <I>control</I> in
<I>Design View</I> and making the change on the Property sheet. (See "Controls:
Properties Change" in the Forms and Reports part of this book.)
<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
<DL>
<DD><B>1. </B>Click a <I>table</I> name in the Tables tab of the <I>Database window</I>,
then choose the <U>D</U>esign button.
<P>
<DD><B>2. </B>Choose the number or currency <I>field</I> and click in the Decimal
Places property on the bottom half of the Table Design window.
<P>
<DD><B>3. </B>Choose Auto to let Access determine the number of decimal places (usually
two), or type in your own number of decimal places.
<P>
<DD><B>4. </B>Click the Close (X) button on the Table Design window and choose <U>Y</U>es
to save the changes to the table design.
</DL>
<H2><FONT COLOR="#000077"><B>Field: Caption as Alternate Name</B></FONT></H2>
<P>Captions enable you to uniquely name the column header in <I>Datasheet View</I>
(as opposed to calling it by the <I>field</I> name). After you add a <I>caption</I>
to a field, any new <I>queries</I>, <I>forms</I>, or <I>reports</I> will use the
caption as the default for column headers or labels for the field. Queries also have
a caption property for each field.
<BLOCKQUOTE>
<P>
<HR>
<FONT COLOR="#000077"><B>NOTE:</B></FONT><B> </B>Labels and column headers for existing
queries, forms, and reports do not change when you change the field's caption in
Table <I>Design View</I>.
<HR>
</BLOCKQUOTE>
<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
<DL>
<DD><B>1. </B>Choose the table in the <I>Database window</I> and choose the <U>D</U>esign
button.
<P>
<DD><B>2. </B>Move to the field to which you want to add the caption. In the lower
half of the Table Design window, click the General tab and click in the Caption box.
<P>
<DD><B>3. </B>Type text for the caption. When finished, close the table and choose
<U>Y</U>es when prompted to save changes to the design of the table.
</DL>
<H2><FONT COLOR="#000077"><B>Field: Create</B></FONT></H2>
<P>You must create a <I>field</I> in a <I>table</I> to use it in a <I>query</I>,
<I>form</I>, or <I>report</I>. A field holds one specific piece of information in
a <I>record</I>. Examples include a company name or a salary. It is better to condense
the information that goes into a field into the smallest unit you can use. For example,
instead of having an entire name in a field, use at least two fields--one for first
name and one for last name. You will then be able to sort, find, and <I>group</I>
information on the last name and use both name fields for mailing labels and letters.
<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
<DL>
<DD><B>1. </B>Open a new table or choose an existing table in the <I>Database window</I>
and choose the <U>D</U>esign button.
<P>
<DD><B>2. </B>In the top half of the Table Design window, move to a blank row and
type a field name.
<P>
<DD><B>3. </B>Press Tab and click the down arrow to choose a <I>data type</I>.
<P>
<DD><B>4. </B>Press Tab again and type a description (which will appear on the <I>status
bar</I> in Datasheet or <I>Form View</I>). If desired, click in the lower half of
the window and set any additional field properties.
<P>
<DD><B>5. </B>When finished, close the Table Design window and choose <U>Y</U>es
when prompted to save the table design.
</DL>
<BLOCKQUOTE>
<P>
<HR>
<FONT COLOR="#000077"><B>NOTE:</B></FONT><B> </B>The description and other field
properties become the defaults for many of the control properties in forms. However,
if you change the table's field properties after you create a form, most of the properties
do not change on the form.
<HR>
</BLOCKQUOTE>
<H2><FONT COLOR="#000077"><B>Field: Default Value</B></FONT></H2>
<P>You can set a <I>default value</I> for a field in the Table <I>Design View</I>
on the General tab. When you enter a value or <I>expression</I> in that <I>property</I>,
that default value is entered into each new record when you create the record. You
are free to overwrite the default value if you have write privileges for that field.
The default value does not affect any <I>records</I> you enter before you create
the default value. You can have a different default value for the <I>field</I> on
a <I>form</I> than the one you create for the table. (See "Forms: Default Value"
in the Forms and Reports part of this book.)</P>
<P>A common default value would be a state or country (entered as <B>CO</B> or <B>USA</B>).
Another common default would be today's date, which you enter as <B>Date()</B>.
<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
<DL>
<DD><B>1. </B>Click the <I>table</I> name in the Tables tab of the <I>Database window</I>,
then choose the <U>D</U>esign button.
<P>
<DD><B>2. </B>Move to the field and click in the Default Value <I>text box</I>, then
enter your value. Or, enter an expression that evaluates to a value.
<P>
<DD><B><BR>
3.</B>Click the Save button on the toolbar to save your new database rule.
</DL>
<P>Because this default value is applied at the table level, the mechanism for entering
the default value operates in a datasheet or form. During an append operation, default
values are not added to the new records that are appended to the table.
<BLOCKQUOTE>
<P>
<HR>
<FONT COLOR="#000077"><B>TIP:</B></FONT><B> </B>Creating default values is a great
time saver and speeds up data entry. When you have a field that usually has the same
value entered into it, consider setting this property.
<HR>
</BLOCKQUOTE>
<H2><FONT COLOR="#000077"><B>Field: Delete</B></FONT></H2>
<P>If you no longer need a field, you can delete it. For instance, after you import
a table from another source you can change the table design to add fields for first
name and last name. After you enter these data for these fields for all your records,
you then want to delete the original name field that contained both names.
<BLOCKQUOTE>
<P>
<HR>
<FONT COLOR="#000077"><B>CAUTION:</B></FONT><B> </B>Be sure that you won't be using
the field again when you delete. All the information in the field is lost for every
<I>record</I>. It will be a large task to find and enter the information for a mistakenly
deleted field. You can use Undo if you immediately notice you deleted the wrong field
or if you choose, when prompted, to not save changes to the database design. However,
this task is so potentially dangerous that you should probably back up your database
first. (See "Backup Data" in the File Management part of this book.)
<HR>
</BLOCKQUOTE>
<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
<DL>
<DD><B>1. </B>Click the <I>table</I> name in the Tables tab of the <I>Database window</I>,
then choose the <U>D</U>esign button.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -