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

access 2003 in pictures phần 9 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 (569.14 KB, 22 trang )


WORKING WITH QUERIES
174
6. Click the button.

The screen should look like this:



Then click the button.







WORKING WITH QUERIES
175
7. When the final screen appears, type:

Find Duplicate Customers

in the name box.



8. Click the button.

The query should run, and look like this:




There are two identical entries for Jane Doe in the database.



WORKING WITH QUERIES
176
Remove duplicates

1. Click the row selector button for the Jane Doe record with the
Customer ID of 7.



2. On the Toolbar, click the icon.




WORKING WITH QUERIES
177
3. When the alert window appears, click the button.



The query results should now look like this:


Record number 7 is removed from the database.


Tip:
Deleting a record from a query also deletes it from the table
it was stored in.




WORKING WITH QUERIES
178
Verify results

1. On the Menu Bar, click File, then Close.

2. In the Objects list, click Tables.



3. Double-click the Customers table.

It should now look like this, with only one record for Jane Doe:



4. Close the Customers table.


WORKING WITH QUERIES
179
Create Update queries


1. Double-click the Products table to open it.

2. Note the price (to customers) of French Truffles ($8.99) and Blue
Mountain Coffee ($9.99).



3. Note the cost (to the store) of French Truffles ($6.15) and Blue
Mountain Coffee ($8.00).



4. On the Menu Bar, click File, then Close to return to the
FoodStore1 database window.


WORKING WITH QUERIES
180
5. In the Objects list, click Queries.



6. Double-click Create query in Design view.




WORKING WITH QUERIES
181

7. When the Show Table window appears, click Products.



Then click the button.






















WORKING WITH QUERIES
182
8. Click the button.


The query window should look like this:



9. On the Menu Bar, click Query, then Update Query.




WORKING WITH QUERIES
183
10. In the field list of the Products table, scroll down and double-
click the Price field.



The query design grid should now look like this:



11. In the Price column, click in the Update To row.




WORKING WITH QUERIES
184
12. Type:


[Cost]*1.25



Then press the ENTER Key.

This will raise prices for all products by 25%.

Tip:
The square brackets
[ ]
tell Access that
Cost
is a field.


13. On the Toolbar, click the icon.

14. When the alert window appears, click the button.



Tip:
No records will appear.

This is a type of Action query, which affects records directly,
rather than a Select query, which retrieves records.




WORKING WITH QUERIES
185
15. On the Menu Bar, click File, then Save.



16. When the Save As window appears, type:

Update Product Prices

in the Query Name box.



Then click the
button.

17. On the Menu Bar, click File, then Close to return to the
FoodStore1 database window.

WORKING WITH QUERIES
186
Verify results

1. In the Objects list, click Tables.

2. Double-click the Products table.

It should open and look like this:




Note the updated price of French Truffles ($7.69) and Blue
Mountain Coffee ($10.00).

3. Click File, then Close to return to the FoodStore1 database
window.

WORKING WITH QUERIES
187
Create Delete queries

1. Double-click the Employees table.

It should open and look like this:



Note that Tom Gumman and Tina Gumman are currently
employees.

2. Click File, then Close to return to the FoodStore1 database
window.

3. In the Objects list, click Queries.

4. Double-click Create query in Design view.




WORKING WITH QUERIES
188
5. When the Show Table window appears, click Employees.



Then click the button.

6. Click the button.

7. On the Menu Bar, click Query, then Delete Query.




WORKING WITH QUERIES
189
The query window should now look like this:



WORKING WITH QUERIES
190
Add fields

1. In the field list of the Employees table, click-and-drag the * field
to the first column of the design grid.




2. Release the mouse button.

The query design grid should look like this:




WORKING WITH QUERIES
191
3. In the field list of the Employees table, double-click the Last
Name field.



The query design grid should now look like this:



WORKING WITH QUERIES
192
Add criteria

1. In the Last Name column of the design grid, click in the Criteria
row.



2. Type:

Gumman


then press the ENTER key.

It should look like this:




WORKING WITH QUERIES
193
3. On the Menu Bar, click the icon.

When the alert window appears, click the button.

Tip:
Be careful when designing Delete queries. Once a record is
deleted, the deletion cannot be undone.

You may want to run the query as a regular query first, to verify
it’s choosing the correct records, and then switch the type to a
Delete query.


4. Click File, then Save.

5. When the Save As window appears, type:

Delete Old Employees

in the Query Name box.




6. Click the button.

7. Click File, then Close to return to the database window.


WORKING WITH QUERIES
194
Verify results

1. In the Objects list, click Tables.

2. Double-click the Employees table.

It should look like this:



Note that Tom Gumman and Tina Gumman are no longer listed
as employees.

3. Exit Microsoft Access.








WORKING WITH REPORTS
195
Working with Reports


In this section, you’ll learn how to:

• Format reports
• Create mailing labels

×