Saving Queries in Access 2013

Muskateer/Getty Images

As any seasoned user knows, being able to save a query is one of the reasons why using databases like Microsoft Access can make work a lot simpler. Databases can be really frustrating to work with when a user wants to create the perfect query for a project or report. After making tweaks and changes to a query, it can be difficult to remember exactly what changes pulled which results.

This is one very good reason to get accustomed to saving queries with some frequency, even if they don’t provide exactly what the user is looking for at the time.

When the same data is required a few days, weeks, or months later, all too often users will find out too late that they forgot to save that nearly perfect query or that they had previously pulled the results they want with one of the experimental queries, resulting in more experimenting to get the same data.

This is a scenario that nearly every Access user can relate to, and one that is very easily avoided by making a habit of saving queries, even if the queries aren’t quite right. Each query that is saved can include some details to help the user determine what needs to be adjusted, so that each query does not have to be written from scratch. It also means that users can copy a good query and use it as a starting point for similar queries with only a few tweaks to get different data.

When to Save Queries

Ultimately saving a query is a matter of preference, but for those who are just beginning that is another unknown area.

Beginners should get in the habit of always saving queries because there is no way to know when one accidental query ends up providing exactly what is needed.

Even these experimental queries can help a new user get familiar with the existing tables, data relationships, primary keys, and other components and properties of the database.

This includes experimental queries when a user is first learning how to create queries in Access. Being able to go back and review how a few changes between queries changes the results can make it much easier to understand how queries work.

It is up to each individual to determine when a query should be saved, but if you are not sure whether or not to save a query, you should go ahead and save. It is easy to delete queries later; it’s much more difficult to replicate one from memory a couple months down the road.

How to Save Queries

There is nothing like a long and difficult set of instructions to make a user decide to forego a useful or even necessary action because it takes too long to complete. Access makes it very easy to save queries to encourage users to save their work as they go.

  1. Design a query.
  2. Modify the query until you get the results needed.
  3. Hit CTRL + S on a PC or Cmmd + S on a Mac.
  4. Enter a name that will be easy to remember for later searches.

Companies and teams should establish guidelines for where to save queries based on type, department, and other areas, as well as a naming convention. This will make it easier for employees to review existing queries before creating new ones.

Cleaning Up After Experimenting with Queries

After spending a considerable amount of time creating the perfect query, most people are ready to close down and move on to something else. However, leaving a record of a large number of experimental queries, even if saved to a designated area for test queries, can make it difficult to locate the useful queries (unless there is a policy to delete all queries in an experimental area on a regular basis).

One way to make cleanup easier is by adding something to the name of queries that are not likely to be needed again. There is also the option of printing or exporting queries and their properties so that the information is not completely lost after being deleted. Even though it may be difficult to know what is and what isn’t useful in the beginning, the longer you hold onto queries, the more difficult it will be to remember which ones are useful and which should be deleted.

It is not necessary to delete queries at the end of a session, but it is a good idea to cleanup queries at least once a month.

Adjusting an Existing Query

As users experiment with different queries, it is likely that they will find that a few tweaks to an existing query will give better or more complete data. It is not necessary to delete these queries and completely replace them because Access allows users to update existing queries with relative ease.

  1. Go to the query in the Design view.
  2. Go to the field or fields that you wish to update and make the necessary modifications.
  3. Save the query.
  4. Go to Create > Query > Query Design > Show Table, then the table associated with the modified query.
  5. Go to Design > Query Type > Update.
  6. Review the updates to make sure that the right fields update.

You can also update the tables for the new changes before running the query if desired, but it is not necessary.

Updating existing queries can save users a lot of time and energy (as well as extra, obsolete queries) that would otherwise go to re-creating the same query with a couple of slight modifications from the beginning.