Access Reference: Working With Tables: Susan Harkins
Access Reference: Working With Tables: Susan Harkins
Introduction
If you don't use Microsoft Access day in and day out, it's easy to forget some of the mechanics involved in
working with its powerful features. TechRepublic contributor Susan Harkins put together this guide, which
provides a rundown of basic information you may need when working with Access tables.
Table of contents
Table anatomy ................................................................................................ 2
Definitions ....................................................................................................... 2
Table views ..................................................................................................... 4
Creating a table............................................................................................... 5
Table properties .............................................................................................. 7
Field properties ............................................................................................... 8
Table limits.................................................................................................... 10
Table tips ...................................................................................................... 11
Keyboard shortcuts/mouse tricks.................................................................. 12
Page 1
Copyright ©2004 CNET Networks, Inc. All rights reserved.
To see more downloads and get your free TechRepublic membership, please visit
http://techrepublic.com.com/2001-6240-0.html.
Access reference: Working with tables
Table anatomy
A table is a collection of data about a specific topic or entity. Because Access is a relational database
program, you use a separate table for each entity. This allows you to build an efficient database with
related tables that eliminate redundant data.
Tables are organized into columns and rows:
• A column defines categories of information, such as an employee’s first name and last name.
• A row contains each piece of information for a particular person or thing.
Column
Row
Definitions
Access terms
Datasheet The graphical interface object used to display data from a table or
query. Data is displayed in rows and columns (similar to a
spreadsheet). You’ll often see the terms table and datasheet used
interchangeably.
Datasheet View A window that displays data from a table or query in a datasheet.
Design View A window that displays table and field properties, which you can
modify.
Focus The field, control, or object that’s active (currently selected).
Header cell The small gray cell at the top of each column that contains the
column’s name or alias.
Jet The data engine (software) Access uses to actually store and retrieve
data. It’s becoming more common to refer to Access tables as Jet
tables to distinguish between Jet and SQL Server tables, since
Access now interfaces with SQL Server tables via the Access .adp
(Project) file. The traditional Access .mdb file uses Jet tables, and the
newer .adp format uses SQL Server tables.
Record selector The small gray square to the left of each row; click this cell to select
the record.
Title bar The bar that extends across the top of the Datasheet View window
and displays the table’s name.
Navigation bar A toolbar with several buttons for navigating records.
Subdatasheet A nested datasheet that displays data in a related table.
Page 2
Copyright ©2004 CNET Networks, Inc. All rights reserved.
To see more downloads and get your free TechRepublic membership, please visit
http://techrepublic.com.com/2001-6240-0.html.
Access reference: Working with tables
Database terms
Data type A field property that determines the type of data a field can accept and
store.
Database A collection of persistent data.
Entity A conceptual collection of one type of data.
Foreign key A primary key value in a related table.
Null An unknown value. Generally a Null value doesn’t equal anything, not
even a blank field. Null is not the same thing as empty or blank,
although Null fields appear to be empty.
Primary key A value that uniquely identifies each record.
Relational A collection of persistent data that’s stored in multiple but related
database tables.
Relational A relational database that integrates the data and the tools needed to
Database manipulate that data. Access is an RDBMS.
Management
System (RDBMS)
Relationship An association between two tables.
Scheme The set of field names for a particular table.
Table The structure that stores related data in a collection of columns and
rows. You may see a table also referred to as a relation.
Table terms
Column A column is a structure used to store pieces of data—data must be
reduced to the smallest unit. A table usually contains many columns.
Field A field represents the data reduced to its smallest terms. You’ll often
see the terms column and field used interchangeably, which is
acceptable in Access.
Row A row comprises all the columns (or fields) for one item within an
entity. The data contained in a row is known as a record. You may see
the terms row and record used interchangeably, but they really aren’t
the same thing. A row is the graphical structure you use to interact
with the data.
Page 3
Copyright ©2004 CNET Networks, Inc. All rights reserved.
To see more downloads and get your free TechRepublic membership, please visit
http://techrepublic.com.com/2001-6240-0.html.
Access reference: Working with tables
Table views
Access offers a couple of ways to look at the tables you create. Figure A shows a table displayed in
Datasheet View. In Figure B, the table appears in Design View.
Figure A
Figure B
Page 4
Copyright ©2004 CNET Networks, Inc. All rights reserved.
To see more downloads and get your free TechRepublic membership, please visit
http://techrepublic.com.com/2001-6240-0.html.
Access reference: Working with tables
Creating a table
There are three ways to create a new table in Access:
• Let the Table Wizard design the table for you. Using a wizard isn’t necessarily more efficient or
easier, but it gives the novice an edge because specific knowledge about data types and field
properties isn’t required.
• Enter data immediately into a generic datasheet in Datasheet View. As you enter data, Access
attempts to define field data types and properties based on the data you enter. You’ll probably need
to tweak the results to get exactly the right properties, but it’s a good way to start entering data—and
you can worry about the table and field structure later. You’d be surprised how accurate Access is
when interpreting the data.
• Build the table from scratch in Design View by adding and defining fields yourself. Once you’re
familiar with Access, this is probably the best route because it’s the most flexible and gives you
complete control.
Using the Table Wizard
If you’re unfamiliar with Access, the Table Wizard can take care of most decisions for you. You identify
the type of data the table will store, and the wizard holds your hand through the process. Follow these
steps to execute the Table Wizard:
1. Press [F11] to display the Database window.
2. Click the Tables button on the Database window’s Object bar. In the resulting list, double-click the
Create Table By Using Wizard option.
Figure C
Page 5
Copyright ©2004 CNET Networks, Inc. All rights reserved.
To see more downloads and get your free TechRepublic membership, please visit
http://techrepublic.com.com/2001-6240-0.html.
Access reference: Working with tables
4. Choose Save As from the File menu or click the Save button on the Datasheet View toolbar.
5. In the resulting dialog box, enter a name and click OK.
6. Because you’re working with a new table definition, Access displays a message that warns you that
the table doesn’t have a primary key. If you click Yes, Access will assign a primary key to the table for
you. (You can click No to proceed without designating a primary key.) After saving the table, the blank
columns and rows disappear, except for the one blank row at the bottom of the datasheet. This is
known as the New Record—and its purpose is just what you might think. That row is ready to accept
the next record of data.
At some point, you’ll want to give those generic field names more descriptive names. To do so:
1. Right-click Field1’s header cell and choose Rename Column or simply double-click the cell.
2. When Access highlights Field1 (in the header cell), type the field’s new name and press [Enter].
Figure D
Page 6
Copyright ©2004 CNET Networks, Inc. All rights reserved.
To see more downloads and get your free TechRepublic membership, please visit
http://techrepublic.com.com/2001-6240-0.html.
Access reference: Working with tables
Table A
New table option Explanation
Datasheet View Opens a blank table in Datasheet View so you can start entering
data immediately.
Design View Opens a blank table in Design View so you can build the table
from scratch.
Table Wizard Executes the Table Wizard.
Import Table Launches a wizard that walks you through the process of
importing data from an external source.
Link Table Launches a wizard that walks you through the process of linking
to data in an external database.
If the data already exists in the form of another table or document, you can use it to create a table. You
do this by:
• Importing or linking to data in another Access database (or other file format).
• Running a Make Table query to create a new table based on a current table. You can copy the
existing data or just the table’s structure.
Table properties
Like all Access objects, tables have a number or properties you can use to better define their purpose.
Table B lists these properties.
Table B
Property Explanation
Description Descriptive text that explains the table’s purpose. You can view this
property in the Database window by choosing Details from the View
menu. By default, the Database window displays a list of tables only by
name.
Default View Specify Datasheet, PivotTable, and PivotChart views of a table (only in
Access 2002). For the most part, you’ll seldom use PivotTable or
PivotChart views of a table.
Validation Rule An expression (formula) that determines domain integrity rules for more
than one field.
Validation Text The message displayed when input violates the table’s Validation Rule.
Filter A constraint (rule) used to limit the records that appear when the table
is open.
Order By Specifies a sorting order that’s applied when the table is open. If there’s
no Order By setting, the table displays records in order of the primary
key. If there’s no primary key, Access displays records in data entry
order.
Orientation Specifies right-to-left display for languages such as Hebrew and Arabic
(Access 2002 and later).
Subdatasheet Name Determines whether subdatasheets display related records. The default
is [Auto], which automatically adds subdatasheets for records in related
Page 7
Copyright ©2004 CNET Networks, Inc. All rights reserved.
To see more downloads and get your free TechRepublic membership, please visit
http://techrepublic.com.com/2001-6240-0.html.
Access reference: Working with tables
Field properties
When building a table from scratch, you’ll need to define each field’s data type and properties. Access
uses these properties to accept or reject data. For example, if you choose a Number data type and try to
enter a string, Access will reject the entry. It’s important to give each field the most appropriate data type
and field size to ensure the validity of your data. Table C lists the field properties, and Table D describes
the available data types.
Remember that field properties are a first-level measure to ensure your data’s integrity. In addition, the
choices you make at the table level permeate the entire database as Access forms and reports tend to
inherit table properties.
Table C
Property Explanation
Field Name The field’s name. Each field name must be unique to the table, but you
can reuse field names in other tables.
Data Type Determines the type of data that the field will accept and store. See Table
D for a list of data types.
Description Optional, descriptive text that describes the field’s data or purpose.
Field Size Limits a Text field to a specific number of characters. For Number fields,
choose a numeric type from the drop-down list: Byte, Integer, Long
Integer, Single, Double, ReplicationID, or Decimal.
Format A selection of predefined formats that determine how Access displays the
actual data. (Formats are specific to the data type.)
Precision This property shows up only if you choose Decimal as the Field Size
setting of a Number data type. This value defines the total number of
digits used to represent a numeric value. The default is 18.
Scale This property shows up only if you choose Decimal as the Field Size
setting of a Number data type. This value determines the number of digits
to the right of the decimal point. This value must be equal to or less than
the Precision value.
Decimal Places Determines the number of decimal places displayed. This setting doesn’t
change the actual value, only the portion you can see.
Page 8
Copyright ©2004 CNET Networks, Inc. All rights reserved.
To see more downloads and get your free TechRepublic membership, please visit
http://techrepublic.com.com/2001-6240-0.html.
Access reference: Working with tables
Input Mask A character string that facilitates data entry by providing visual clues. For
instance, a phone number field might display the characters ( )___-____
when the field has focus.
Caption An alias that Access displays in the column’s header cell in lieu of the
field’s actual name.
Default Value The value Access assumes for this field when you create a new record
(except for AutoNumber and OLE Object fields).
Validation Rule A constraint (rule) the entry must past before Access will accept and store
the value. Similar to the table’s Validation Rule, except at the field level,
the rule applies to a single field. This property isn’t available for
AutoNumber, Memo, or OLE Object fields.
Validation Text Text that Access displays when input fails to satisfy the Validation Rule
setting.
Required Allows or prohibits Null values. If set to Yes, you must enter a value for
this field before Access will save the new record.
Allow Zero Length If set to Yes, the field accepts the zero-length string (“”). The field appears
to be empty. The zero-length string isn’t the same thing as a Null value.
Indexed Defines an index for the field (except for Memo, OLE Object, and
Hyperlink fields). Choose an index type from the field’s drop-down list.
New Values Choose Increment or Random to determine the type of values generated
by an AutoNumber field. Increment is the default and adds 1 to the
highest existing value for each new record. You probably won’t change
this to Random unless you’re working with a replicated database.
Unicode An Encoding method that accommodates two-byte characters. Unless
Compression you’re working with a language that requires the extra resources, use the
default setting of No.
IME Mode and IME Works with the Office Input Method Editor (in Access 2002 and later).
Sentence Mode
Smart Tags New to Access 2003, this property provides a link to Internet resources.
Table D
Data Type Description
Text Contains up to 255 characters—any characters Access interprets as text
characters. That means you can’t directly perform any kind of math operations
on the data.
Memo A large Text field—up to 65,535 characters.
Number Supports several numeric subtypes: Byte, Integer, Long Integer, Single,
Double, ReplicationID, and Decimal.
AutoNumber A Long Integer Number field that automatically generates a value for each new
record. By default, this field begins with the value 1 and increments by 1.
Yes/No A logical field that equals either –1 for Yes or True or 0 for No or False.
Currency A special fixed format with four decimal places that prevents rounding errors
when storing values that must be exact.
Page 9
Copyright ©2004 CNET Networks, Inc. All rights reserved.
To see more downloads and get your free TechRepublic membership, please visit
http://techrepublic.com.com/2001-6240-0.html.
Access reference: Working with tables
Date/Time Stores a value where the integer portion represents the date and the decimal
portion represents a specific point in time within that particular 24-hour period.
OLE Object A data type that accommodates large files, usually graphic files.
Hyperlink A type of Text field that stores a Web address or document address. The
stored value serves as a link; when clicked, it automatically accesses the
address.
Lookup Wizard This isn’t a true data type but rather a special field property that displays a
value other than the stored value.
Table limits
Although most users will never reach the maximum limits for table attributes, there are limits. Table E lists
them.
Table E
Attribute Maximum
Number of characters in a table’s name 64
Number of characters in a field’s name 64
Number of fields in a table 255
Number of open tables 2,048 (or fewer, depending on the number of
tables opened internally by Access)
Table size 2 gigabytes minus the space needed for the
system objects
Number of characters in a Text field 255
Number of characters in a Memo field 65,535 when entering data through the user
interface; 1 gigabyte when entering data
programmatically
Size of an OLE Object field 1 gigabyte
Number of indexes in a table 32
Number of fields in an index 10
Number of characters in a validation 255
message
Number of characters in a validation rule 2,048
Number of characters in a table or field 255
description
Number of characters in a record (excluding 2,000
Memo and OLE Object fields)
Number of characters in a field property 255
setting
Page 10
Copyright ©2004 CNET Networks, Inc. All rights reserved.
To see more downloads and get your free TechRepublic membership, please visit
http://techrepublic.com.com/2001-6240-0.html.
Access reference: Working with tables
Table tips
A little guidance
Use a field’s Description setting to display information that the user might find useful in the Status bar in
Datasheet View. For instance, you might use the text “Enter an integer value between 1 and 10” or “Enter
the employee’s last name” to offer clues about the data stored in that field. A bound form will also display
the Description property text—other objects inherit field-level properties.
Optimum field size
When choosing a Field Size property, select the option that requires the smallest number of bytes to get
the job done. (See Table D.) For instance, Integer and Long Integer would be overkill for a field that
contains values from 0 to 255. The most efficient choice in this case would be Byte. The larger the option,
the more resources the field zaps. On the other hand, don’t be too stingy—makes sure the field can
accommodate the largest value possible. You don’t want the field to reject a valid entry just because it
doesn’t fit.
Validation help
Counting your bytes isn’t as important as it use to be because memory is so inexpensive and easily
accessible. However, a field’s size can help validate data by accepting only those values of the required
size. For example, every entry in a Text field that stores two-letter state abbreviations should be two
characters. By setting the Field Size to 2, you can automatically eliminate entries that contain more than
two characters—Access will reject them. This measure won’t catch entries that are fewer than two
characters.
Default size for Text or Numbers
If you find yourself changing the Field Size property a lot, change the default. To do so, choose Options
from the Tools menu and then click the Tables/Queries table. Enter the value you’d like to be the new
default for Text or Number field types.
Avoiding rounding issues
Use the Decimal data type for fractional values that you include in any calculations to avoid rounding
errors.
Caption caveat
If you use the Caption property, Access ignores any field alias you may use in a query. Even SQL’s AS
keyword is ignored. In addition, Caption properties don’t make it to the results of a Make Table query.
Table deletion
To delete a table, select the table in the Database window and press [Delete]. When Access asks you to
confirm the action, click Yes. Before deleting a table, consider creating a copy or exporting the data to a
storage or archiving database specifically for that purpose. To avoid the confirmation click, press
[Shift][Delete] instead of just [Delete]. Just be careful that you’re ready to delete all that data. You can
undo the delete by clicking Undo or choosing Undo Delete from the Edit menu, but you must do so
immediately.
Advice on linking
Linked tables can be a drain on performance. Use the following guidelines to help improve performance
when working with linked tables:
1. Limit the number of records that you view by using filters or queries.
2. Don’t move up and down the page unnecessarily in Datasheet View.
3. Don’t move to the last record unless necessary.
Page 11
Copyright ©2004 CNET Networks, Inc. All rights reserved.
To see more downloads and get your free TechRepublic membership, please visit
http://techrepublic.com.com/2001-6240-0.html.
Access reference: Working with tables
Page 13
Copyright ©2004 CNET Networks, Inc. All rights reserved.
To see more downloads and get your free TechRepublic membership, please visit
http://techrepublic.com.com/2001-6240-0.html.
Access reference: Working with tables
Page 14
Copyright ©2004 CNET Networks, Inc. All rights reserved.
To see more downloads and get your free TechRepublic membership, please visit
http://techrepublic.com.com/2001-6240-0.html.
Access reference: Working with tables
Page 15
Copyright ©2004 CNET Networks, Inc. All rights reserved.
To see more downloads and get your free TechRepublic membership, please visit
http://techrepublic.com.com/2001-6240-0.html.
Related TechRepublic resources:
Microsoft Access
Downloads:
Microsoft Access 2000 Sample Database
Microsoft Access 2000 Support Log
Page 16
Copyright ©2004 CNET Networks, Inc. All rights reserved.
To see more downloads and get your free TechRepublic membership, please visit
http://techrepublic.com.com/2001-6240-0.html.
TechRepublic:
The collective voice of IT professionals
CIO Republic: Get analysis and insight on e-business, leadership, executive careers, business strategy,
and technology.
IT Manager Republic: Access technology insights, project and personnel management tips, and training
resources.
NetAdmin Republic: Get tips on Windows, NetWare and Linux/UNIX administration, infrastructure
design, and network security.
Support Republic: Obtain detailed solutions to desktop hardware, software, and end-user support
problems.
IT Consultant Republic: Find information and advice on client and vendor relations, project
management, and technology.
Page 17
Copyright ©2004 CNET Networks, Inc. All rights reserved.
To see more downloads and get your free TechRepublic membership, please visit
http://techrepublic.com.com/2001-6240-0.html.