You are on page 1of 28

INFORMATION SHEET NUMBER 6

Modify a Table
After you create a table, you may need to modify it. You can delete columns, insert columns, or move
columns.

Delete Columns
The Delete option permanently deletes columns and all the data contained in them. You cannot undo a
column delete.

To delete columns:

1. Click and drag to select the columns you want to delete.


2. Activate the Datasheet tab.
3. Click Delete in the Fields & Columns group. A prompt appears.
4. Click Yes. Access deletes the columns you selected.
Insert Columns
The Insert option inserts a column before the selected column.
To insert a column:
1. Click the column head of the column before which you want to insert a column.
2. Activate the Datasheet tab.
3. Click Insert in the Fields & Columns group. Access inserts a new column.
 Tip: If you right-click a column label, you can use the menu that appears to insert or delete
columns.

To delete a column:
1. Right-click the column head you want to delete. A menu appears.
2. Click Delete Column.

To insert a column:
1. Right-click the column head before which you want to insert a column. A menu appears.
2. Click Insert Column.

Move a Column
You can use the Move option to move a column from one location to another.
To move a column:
1. Move your mouse pointer over the horizontal line under the column label. Your mouse pointer
turns into a four sided arrow.
2. Press your left mouse button
3. Click and drag the field to the new location. A dark line appears at the new location.
4. Release you left mouse button. Access moves the column.
Move around a Table
Access provides several methods for moving around a table. On the Home tab, there is a Go To
button. When you click it, a menu of options appears. You can use the menu to go to the first, last,
previous, or next record in your table. You can click the New option to add a new record. You can also
use special keys and the navigation bar in Access to move around a table. The navigation bar appears
at the bottom of the table.

To use the Go To button to move around a table:


1. Activate the Home tab.

2. Click the Go To button in the Find group. A menu appears.

3. Click First to go to the first record, Previous to go to the previous record, Next to go to the next
record, Last to go to the last record, or New to create a new record.

  Tip: You can also create a new record by choosing the Home tab and then clicking New in the
Records group.
To use keys to move around a table:

Key to Press Action

Tab Moves to the next field to the right. If you are in the last
field in a record, moves you to the next record. If you
are in the last record in a table, creates a new record.

Left-Arrow Moves to the next field to the left. If you are in the first
field in a record, moves you to the previous record.

Shift+Tab Moves to the previous field. If you are in the first field in
a record, moves you to the previous record.

Right-Arrow Moves to the next field. If you are in the last field in a
record, moves you to the next record. If you are in the
last record in a table, creates a new record.

Up-Arrow Moves you up one record.


Down-Arrow Moves you down one record.

Ctrl++ Creates a new record.

To use the Navigation bar to move around a table:

1 Go to First Record

2 Go to Previous Record

3 The Current Record

4 Go to Next Record

5 Go to Last Record

6 Create a New (Blank) Record

Select Columns and Rows


Before you can perform an operation on a column or row, you must select it. To select a column, click
the column head. To select several columns, click a column head and then drag. To select a row, click
the blank area to the left of the row. To select several rows, click the blank area to the left of a row and
then drag. To select the entire table, click the Select All button   in the upper-left corner of the table.
 

Delete a Record
If enter a record by error, you can delete it.
To delete a record:
1. Select the record you want to delete.
2. Activate the Home tab.
3. Click Delete in the Records group. A prompt appears.
4. Click the Yes button.
Or
 Select the record you want to delete.
 Right-click. A menu appears.
 Click Delete Record. A prompt appears.
 Click the Yes button.
Resize a Column or Row
If all of the information in a column or row does not display, you may want to make the column or
row larger. If you want to fit more information on the screen, you may want to make a column or row
smaller. In either case, you can click and drag to increase or decrease column width or row height.
To resize a column or row:
1. Place the cursor over the line that separates two columns or two rows. The cursor turns into a
double-sided arrow.
2. Hold down the left mouse button and drag to increase or decrease the width of a column or the
height of all of the rows.
INFORMATION SHEET NUMBER 7

Sorting & Filtering


You can sort Access data so you can view records in the order you want to view them, and you can
filter data so you only see the records you want to see. This lesson teaches you how to sort and filter
an Access table.
Access data is stored in multiple tables. Relationships join tables together so you can work with the
data from multiple tables. This lesson also teaches you how to create relationships.

Sort a Table
By sorting, you can put a column of information in alphabetical, numerical, or date order. You can sort
in ascending order (alphabetical from A to Z, lowest number to highest number, earliest date to latest
date) or descending order (alphabetical from Z to A, highest number to lowest number, latest date to
earliest date). You can also sort within a sort. For example, you can sort by state and then sort within
each state by city. When sorting within a sort, perform the innermost sort first. For example, if you are
sorting by state and then city, sort the city first and then sort by state.

To add a sort:

1. Click the column label for the column you want to sort.
2. Activate the Home tab.

3. Click the Ascending   or Descending   button in the Sort & Filter group. Access sorts the
column in ascending or descending order.
To remove a sort:
1. Activate the Home tab.

2. Click the Clear All Sorts   button in the Sort & Filter group. Access clears all of the sorts you
have applied.

Filter a Table
You can apply a filter to see only the records you want to see. For example, perhaps your database
contains students from the states of DE, NJ, and PA and you only want to see the students from DE.
You can filter your data so only DE students display.
Each time you apply a filter to a column, it replaces any previous filter you applied to that column. For
example, if you apply a filter so you only see students in DE, and later you apply a filter so you only see
students in NJ, Access clears the DE filter and then applies the NJ filter.
You can apply filters to multiple columns in the same table. For example, by applying a filter first to the
State field and then to the Last Name field, you can see all of the students in the state of DE whose last
names are Adams.

To apply a filter:

1. Click the column label for the column you want to filter.
2. Activate the Home tab.
3. Click the Filter button. A menu appears.
4. Uncheck the items you do not want to appear, making sure only the items you want are
checked.
5. Click OK. Access filters your data and displays the word Filtered at the bottom of the window.
To remove a filter:
1. Activate the Home tab.
2. Click Advanced in the Sort & Filter group. A menu appears.
3. Click Clear All Filters. Access clears all the filters you have applied.

 Tip: After you apply a filter, you can use the Toggle Filter button to toggle the application of the
filter on and off.
Apply a Specialized Filter
In addition to simply searching for a specific value, you can apply several specialized filters. For example, you
can find all of the records that do not equal the value you specify or you can find all of the records that fall
between two dates. The following are lists of specialized filters.

Text Filters

Finds every record in the table


Equals
where the field’s value equals the
value you enter.

Finds every record in the table


Does Not Equal
where the field’s value does not
equal the value you enter.

Finds every record in the table


Begins With
where the field’s value begins with
the value you enter.

Finds every record in the table


Does Not Begin With
where the field’s value does not
begin with the value you enter.

Finds every record in the table


Contains
where the field’s value contains
the value you enter.

Finds every record in the table


Does Not Contain
where the field’s value does not
contain the value you enter.

Finds every record in the table


Ends With
where the field’s value ends with
the value you enter.

Finds every record in the table


Does Not End With
where the field’s value does not
end with the value you enter.

Number Filters

Finds every record in the table


Equals
where the field’s value equals the
value you enter.

Finds every record in the table


Does Not Equal
where the field’s value does not
equal the value you enter.

Finds every record in the table


Less Than
where the field’s value is less than
the value you enter.

Finds every record in the table


Greater Than
where the field’s value is greater
than the value you enter.

Finds every record in the table


Between
where the field’s value is between
the values you enter.

Date Filters

Finds every record in the table


Equals
where the field’s value equals the
date you enter.

Finds every record in the table


Does Not Equal
where the field’s value does not
equal the date you enter.

Finds every record in the table


Before
where the field’s value is before
the date you enter.

Finds every record in the table


Greater Than
where the field’s value is greater
than (comes after) the date you
enter.

Finds every record in the table


Between
where the field’s date is between
the dates you enter.

Finds every record in the table


All Dates in a Period
where the field’s date is in the
period you enter.

To apply a specialized filter:

1. Click the Last Name column label.


2. Activate the Home tab.
3. Click the Filter button. A menu appears.
4. Click the Text Filters option. A menu appears.
5. Click the option you want. A Custom Filter dialog box appears.

6. Enter the appropriate information.

7. Click OK. Access filters your data and displays the word Filtered at the bottom of the window.

Hide Columns
There may be times when you may not want to display a certain column or set of columns. In such
cases, you can temporarily hide the column or columns from view. Later, if you want to display them
column again, you can unhide them.

To hide columns:

1. Select the columns you want to hide.


2. Activate the Home tab.
3. Click the More button in the Records group. A menu appears.
4. Click Hide Columns. Access hides the columns you selected.

In the figure, the Birth Date, Street Address, City, State, and Zip fields are hidden.
Or
1. Select the columns you want to hide.
2. Right-click. A menu appears.
3. Click Hide Columns.

To unhide columns:
1. Activate the Home tab.
2. Click the More button in the Records group. A menu appears.
3. Click Unhide Columns. The Unique Columns dialog box appears.
4. Select the column you want to display.
5. Click Close. Access displays the columns you chose.
or
1. Right-click any column label. A menu appears.
2. Click Unhide columns.
3. Select the columns you want to display.
4. Click the Close button. Access displays the columns you selected.

Freeze Columns
If your table has a large number of columns, you may want to freeze columns so the frozen columns
stay in view as you scroll across the page.  For example, if you have a Students table and you want the
Student Number, First Name, and Last Name to remain onscreen as you scroll across the table, you
can freeze the Student Number, First Name, and Last Name fields. When you freeze a column, Access
moves it to the far left side of your table. If you want it to remain there, you must save the table.
To freeze columns:

1. Select the columns you want to freeze.


2. Activate the Home tab.
3. Click the More button in the Records group. A menu appears.
4. Click Freeze. Access freezes the columns. As you scroll, the frozen columns remain stationary.
To unfreeze columns:
1. Activate the Home tab.
2. Click the More button in the Records group. A menu appears.
3. Click Unfreeze. Access unfreezes the columns.
INFORMATION SHEET NUMBER 8
Format a Table
You can use the features in the Font group on the Home tab to apply a variety of formats to your table.

Format a Table

Button Function

Apply a font to all of the data in a


table.

Apply a font size to all of the data in a


table.

Bold all of the data in a table.

Italicize all of the data in a table.

Underline all of the data in a table.

Left-align a column.

Right-align a column.

Center a column.

Change the font color.

Change the background color. By


default, the background color is white.

Change the gridlines. Gridlines


separate columns and rows. This
option allows you to display gridlines
for columns only (vertical), gridlines
for rows only (horizontal), gridlines
for both columns and rows, or no
gridlines at all.

Change the alternating color. For


example, on a datasheet you can have
every other row appear in an
alternating color.

To bold, italicize, or underline:


1. Place the cursor anywhere within the table.
2. Activate the Home tab.
3. Click the button for the format you want to apply. Access applies the format.
To left-align, right-align, or center:
1. Place the cursor anywhere within the column you want to left-align, right-align, or center.
2. Activate the Home tab.
3. Click the button for the format you want to apply. Access applies the format.
To change the font, font size, or gridlines:
1. Place the cursor anywhere within the table.
2. Activate the Home tab.
3. Click the down-arrow to the right of the option you want to apply. A menu appears.
4. Select the option you want. Access changes the font, font size, or gridlines.
To change the font color, background color, or alternating color:
1. Place the cursor anywhere within the table.
2. Activate the Home tab.
3. Click the down-arrow to the right of the option you want to apply. A menu of colors appears.
4. Select the color you want. Access changes the font color or the alternating color.
Compute Totals
On the Home tab, you can use the Total button in the Records group to compute the sum, average,
count, minimum, maximum, standard deviation, or variance of a number field; the count, average,
maximum, or minimum of a date field; or the count of a text field.

To compute totals:

1. Open the table or query for which you want to compute totals.
2. Activate the Home tab.
3. Click the Totals button in the Records group. A Total line appears at the bottom of the table or
query.
4. Click on the Total line under the column you want to total. A down-arrow appears on the left side
of the field.
5. Click the down-arrow and then choose the function you want to perform. Access performs the
calculation and displays the results in the proper column on the Totals row.

Find and Replace


If you need to find a sequence of characters, a word, or a phrase in a table or field, you can use the
Find command. In Access, the Find command has three options: You can find all instances in a
table or field that match a sequence of characters, all instances that begin with a sequence of
characters, or all instances that contain a sequence of characters. For example, you can find all
students with the last name Smith, all students whose last name begins with S, or all instances of
08 anywhere in the field.
After you find the word, phrase, or sequence of characters you are searching for, you can replace it
with a new sequence of characters by executing the Replace command.

To do a Find:

1. Place your cursor in the column you want to search.


2. Activate the Home tab.
3. Click the Find button in the Find group. The Find and Replace dialog box appears.

4. Activate the Find tab.


5. Type what you want to find in the Find What field.
6. Choose the name of the table you want to search in the Look In field if you want to search the
entire table or select the field you selected in step 1 if you want to search that field. If you want to
search another field, click in that field and then select it in the Look In field.
7. Choose Any Part Of Field if you want to search for your entry anywhere within a field, choose
Whole Field if you want the field to match the sequence of characters you entered, or choose Start
Of Field if you want the field to begin with a sequence of characters you entered.
8. Choose All in the Search field if you want to search the entire table, Up to search upward from
your current location, or Down to search downward from your current location.
9. Click Find Next to begin your search. Access finds the first entry that matches your find criteria.
Continue clicking Find Next to find additional matches.

  Note: If you want to find and replace, open the Find and Replace dialog box (follow steps 1
through 3) and then activate the Replace tab. In the Replace With field, enter the sequence of
characters you want to use to replace what you find. Complete the other fields on the tab the same
as you would if you were doing a Find. Click Find Next to find the first instance for which you are
searching. Click Replace to replace that instance. Click Replace All to replace every instance.
INFORMATION SHEET NUMBER 9
Create Relationships
In Access, you store data in multiple tables and then use relationships to join the tables. After you have created
relationships, you can use data from all of the related tables in a query, form, or report.
A primary key is a field or combination of fields that uniquely identify each record in a table. A foreign key is a
value in one table that must match the primary key in another table. You use primary keys and foreign keys to
join tables together—in other words, you use primary keys and foreign keys to create relationships.
There are three types of relationships: one-to-one, one-to-many and many-to-many relationship
1. One-to-One relationship
For each record in one table, there is one and only one matching record in a different table. It is as if two
tables have the exact same primary key. Typically, data from different tables in a one-to-one relationship will
be combined into one table.

2. One-to-Many Relationship
Can be established when one record from a table is related to many matching records in other table. For
example, an ID number assigned to a student in the students table might also be used in a table containing
information about the books he/she borrowed or returned.
A one-to-many relationship between tables can be identified by the infinity symbol on the line connecting the
tables.
When tables have a one-to-many relationship, the table with the one value is called the primary table and the
table with the many values is called the related table. 

3. Many-to Many Relationship


Is an association between two tables in which one record in either table can relate to many records in the
other table. To establish one create a third table and add the primary key fields from the other two tables to
this table.
Enforcing Referential Integrity
Referential Integrity ensures that relationships between records in related tables are valid and
that you don’t accidentally delete or change related data. If you mark this check box without marking
either Cascade Update Related Fields or Cascade Delete Related Tables, you won’t be allowed to
change the value of a primary key in one table, because making such a change would leave all the
related records in the table unmatched. This ensures integrity of your data.

Cascade Update
- updates of all related records in the table or tables when a recode in the primary tables is
changed.

Cascade delete
- deletes all related table or tables when a record in the primary tables is deleted

For relationship in which referential integrity is


enforced, you can specify whether you want
Microsoft Access to automatically cascade update
and cascade delete related records. If you set
these options, delete and update operations that
would normally be prevented by referential
integrity rules are allowed. When you delete
records or change primary key values in a primary
table, Microsoft Access makes necessary
changes to related tables to preserve referential
integrity.

To create relationships:
1. Close all tables and forms. (Right-click on the tab of any Object. A menu appears. Click Close All.)

2. Activate the Database Tools tab.


3. Click the Relationships button in the Show/Hide group. The Relationships window appears.
4. If anything appears in the relationships window, click the Clear Layout button in the Tools group. If you
are prompted, click Yes.
5. Click the Show Table button in the Relationships group. The Show Table dialog box appears.

6. Activate the Tables tab if your relationships will be based on tables, activate the Queries tab if your
relationships will be based on queries, or activate the Both tab if your relationships will be based on both.
7. Double-click each table or query you want to use to build a relationship. The tables appear in the
Relationships window.
8. Click the Close button to close the Show Table dialog box.

9. Drag the (Student Number Field) from Primary table primary key over the related table (Student ID Field)
foreign key. After you drag the primary key to the related table’s box, the cursor changes to an arrow. Make
sure the arrow points to the foreign key. The Edit Relationships Dialog box appears.
10. Click the Enforce Referential Integrity checkbox.
11. Click Create. Access creates a one-to-many relationship between the tables.

12. Click the Save button on the Quick Access toolbar to save the relationship.

Tip: When you create a relationship, you can view the related table as a subdatasheet of the primary
table. Open the primary table and click the plus (+) in the far left column. The plus sign turns into a
minus (-) sign. If the Insert Subdatasheet dialog box opens, click the table you want to view as a
subdatasheet and then click OK. Access displays the subdatasheet each time you click the plus sign in
the far left column. Click the minus sign to hide the subdatasheet.

Deleting / Editing Relationship


After a relationship has been created between two tables, you must delete/edit the relationship before
you can make modifications to the fields on which the relationship is based. To delete/edit a
relationship:
1. Right-click the line that connects the tables.
2. Click the Delete/Edit Relationship option.

INFORMATION SHEET NUMBER 10


 
QUERY
Is a database object used to view, change, and analyze data in different ways. There are five
main types of queries: Select, Cross tab, SQL, Action, and Parameter. In this lesson you will learn the
two most commonly used queries: Select query and parameter query.
Queries are very useful tools when it comes to databases and they are often called by the user
through a form. They can be used to search for and grab data from one or more of your tables, perform
certain actions on the database and even carryout a variety of calculations depending on your needs.
When it comes time to build a query for your database, you have two ways to go about creating it.
1. Either use the Query Wizard that Microsoft Access provides for you, or
2. Create your own queries from scratch.

Types of Queries

 Select query
- retrieves data from one or more tables and then displays the results in a datasheet. For
example, you can use a Select query to display all students who borrowed books from the library
with the information about the books they borrowed. You can also use a Select query to group
records and calculate sums, counts, average, and other types of totals.

 Parameter query
- is a query that when run displays its own dialog box prompting you for information, such
as criteria for retrieving records or a value you want to insert in a field. For example you might
want to look for all the books under the subject Science; or you might want Access to display all
transactions made between a specific data range. You can type the criteria in the dialog box and
Access will conduct searches and display the entire database on the criteria you specify.

 Crosstab query
- is used to calculate and restructure data for easier analysis of your data. Crosstab
queries calculate a sum, average, count, or other type of total for data that is grouped by two
types of information, one down the left side of the datasheet and another across the top. It
displays values in a spreadsheet-style table.

 Action query
- is a query that makes change to or move many records in just one operations. It can
delete or update group of records from one or more tables, add a group of records from one or
more tables, and create a new table from all or part of the data from one or more tables.
When the action query is called, the database undergoes a specific action depending on
what was specified in the query itself. This can include such things as creating new tables,
deleting rows from existing ones and updating records or creating entirely new ones.
Action queries are very popular in data management because they allow for many
records to be changed at one time instead of only single records like in a select query.
Four kinds of action queries are:
1. Append Query – takes the set results of a query and "appends" (or adds) them to an
existing table.
2. Delete Query – deletes all records in an underlying table from the set results of a query.
3. Make Table Query – as the name suggests, it creates a table based on the set results of a
query.
4. Update Query – allows for one or more field in your table to be updated.

 SQL query
- is a query you create by using an SQL statement. You can use Structured Query
Language (SQL) to query, update, and manage relational databases in Access.

Open Tables or Queries in Query Design View


A query can be based on tables or on other queries. To create a query, you open the tables or queries
on which you are going to base your query in Query Design view, and then use the options in Design
view to create your query. You then click the Run button to display the results. You can save queries
for later use.

To Create a Select Query

1. Activate the Create tab.


2. Click the Query Design button in the Other group. The Show Table dialog box appears.
3. Activate the Tables tab if you want to base your query on tables, activate the Queries tab if you
want base your query on queries or activate the Both tab if you want to base your query on both
tables and queries.
4. Click to choose the table or query on which you want to base your query.
5. Click Add. The table appears in the window.
a. Click to choose the next table or query on which you want to base your query.
b. Continue clicking tables or queries until you have all the tables and queries you plan to
use.
6. Click Close. Access changes to Query Design view.

Display All Records and All Fields


In Query Design view, each table has an option that allows you to display all of the fields and all of the
records in a table. This option appears on the field line on the drop-down menu as the table name
followed by a period and an asterisk (tablename.*).

To display all records and all fields:

1. Open a table or query in Query Design view.


2. Click the down-arrow in the first field on the Field row and then select the tablename.* option.
The table name appears on the table line.
3. Click the Run button. Access retrieves all of the fields and records for the table and displays
them in Datasheet view.
Change from Datasheet View to Query Design View
After you run a query, you can easily change back to Query Design view and make modifications to
your query or create a new query.
To change to Query Design view:

1. Activate the Home tab.


2. Click the down-arrow below View in the Views group. A menu appears.
3. Click Design View. Access changes to Query Design view. You can modify your query.

 Tip: You can also click the Design button   in the lower-right corner of the Access window to
change to Design view.
Create a Query That Uses Two or More Tables
If you want to view data from two or more tables or queries, you can create a query that pulls the data
from multiple tables or queries. The tables and queries from which you pull your data should have a
relationship.
To create a query that uses two or more tables:
1. Open the tables and/or queries you want to use in Query Design view.
2. Choose the field names you want to retrieve in the order you want to retrieve them.
3. Click the Run button. Access retrieves the columns you chose and displays the rows in the order
you specified.

Save a Query
After you create a query, you can save it. You can rerun a saved query at any time. If you change the
data on which the saved query is based, you will see the changes when you rerun the query.

To save a query:
1. Click the Save button on the Quick Access toolbar. Access saves the query unless you are
saving for the first time. If you are saving for the first time, the Save As dialog box appears.
2. Type the name you want to give your query.
3. Click OK. Access saves the query. You can now access the query by using the Navigation pane.

   Tip: You can also save by right-clicking a query’s tab and then selecting Save from the menu
that appears. Access saves the query unless you are saving for the first time. If you are saving for the
first time, the Save As dialog box appears. Type the name you want to give the query and then click
OK. Access saves the query. You can now access the query by using the Navigation pane.

   Tip: After you have saved a query, you can run it by opening the Navigation pane and then
clicking the name of the query.

Create a Parameter Query


If instead of entering predetermined criteria, you want to prompt users when a query runs, you can
create a parameter query. You create a parameter query by enclosing in square brackets ([]). For
example, if you want to create a parameter query that asks users which Town they want to use from
the Student’s table, you would type [Which Town?] on the Criteria line under the Town column. When
the query runs, Access will prompt the user for the answer to your question.

To create a parameter query:


1. Open a table or query in Query Design view.
2. Create your query.
3. On the Criteria line, type the prompt within square brackets.
4. Click the Run button. Access prompts you.

5. Respond to the prompt.


6. Click OK. Access displays the results of your query in Datasheet view.

You might also like