Chapter 8. Queries That Update Records
Queries are most famously known for their ability to show small subsets of huge amounts of information. This type of queryâs called a select query, and itâs the variety you learned about in the previous two chapters.
Many Access fans donât realize that queries have another identity. Not only can you use them to search for information, but you can also use them to change data. Queries that take this more drastic stepâwhether itâs deleting, updating, or adding recordsâare known collectively as action queries.
Understanding Action Queries
Action queries arenât quite as useful as select queries, because they tend to be less flexible. You create an ideal query once, and reuse it over and over. Select queries fit the bill, because youâll often want to review the same sort of information (last weekâs orders, top-selling products, class sizes, and so on). But action queries are trickier, because they make permanent changes.
In most cases, a change is a one-time-only affair, so you donât have any reason to hang onto an action query that just applies the same change all over again. And even if you do need to modify some details regularly (like product prices or ware-house stocking levels), the actual values you set arenât the same each time. As a result, you canât create an action query that can apply your change in an auto-mated fashion.
But before you skip this chapter for greener pastures, itâs important to consider some cases ...
Get Access 2007: The Missing Manual now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.