Protecting Your Data

3 4

When you’re creating an action query, you’ll first want to consider protecting your data. An action query can change data. In most cases, these changes can’t be undone, which means that an action query can potentially destroy data. There are two ways to protect your data, one more complex (but more secure) than the other. The quick way is to simply switch to Datasheet view after setting up your action query (and before running it). You’ll be able to see the records selected for modification, so you can verify that the query is selecting the right records.

When you’re working with a delete, an update, or an append query, for even more assurance that your update won’t go wrong, make a copy of the table you want to modify before you run the action query, and then run the query. Open the table with modified data, and verify that the modifications are correct. If the action query doesn’t work correctly, delete the modified table, rename the copy using the name of the original table, and then change the query as needed.

There’s no need to create a backup table to check the results of running a make-table query. A new table is created each time you run a make-table query, so if the output table isn’t right, just modify the query as needed and run it again.

To create a copy of a table, follow these steps:

  1. Click the table in the Database window, and press Ctrl+C.
  2. Press Ctrl+V. Access will display the Paste Table As dialog box, shown in Figure 10-1.

    figure 10-1. enter a name for your copied table in the paste table as dialog box.

    Figure 10-1. Enter a name for your copied table in the Paste Table As dialog box.

  3. Enter a name for the copied table. Be sure to enter a new name, such as Copy of table, where table is the name of the original table.
  4. Choose the Structure And Data option, and then click OK to add the new table to the Database window list. The copied table will be identical to the original, including the data.

caution


Many action queries accomplish one-time tasks, so you won’t need to save them. If you do save an action query for repeated use, it’s important that you run it only at the correct time—running an action query at the wrong time can destroy the integrity of your data. If you’re running queries in a specific sequence or at a specified time, you must keep to that schedule; running an action query out of sequence or before or after the set time can be dangerous. For instance, you might use a query to update stock inventory after filling orders at the end of the day. If you run the update query before the orders are actually filled and then run the query again after you’ve filled the orders, you’d double the amount of inventory subtracted that day. Double-clicking a query will run it, as will opening an action query in Datasheet view. Avoid taking either of these steps unless you mean to run the query.



Microsoft Access Version 2002 Inside Out
Microsoft Access Version 2002 Inside Out (Inside Out (Microsoft))
ISBN: 0735612838
EAN: 2147483647
Year: 2005
Pages: 172
Authors: Helen Feddema

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net