Microsoft Access - Modify a Query
In the previous lesson, we created a query using the "Simple Query Wizard". In this lesson, we will modify that query using "Design View".
- From Datasheet View, switch to Design View by clicking on the Design View icon (from the tool bar):
(If you can't see this icon, select "Design View" from the "View" menu). You should now see something like this:
The top panel shows us the tables that are used in this query (we only use one table in our query). The bottom panel is where we specify what to do with each field in the table. We can nominate to display a field or not display it. We can sort the results by any of these fields. We can also provide criteria to be used in filtering the results. We'll do this in the next step.
- In the "Criteria" cell for the "FirstName", add the word "Homer". While you're there, add the IndividualId field so that it will also be displayed in our results. Do this by selecting "IndividualId" from the dropdown menu on the third column. Also, ensure that the "Show" checkbox is checked:
Now when you switch back to Datasheet View, you should now see something like this:
So you can see that, once we get a lot more data into our database, queries can be very useful. Imagine if there were 100 individuals in our database called "Homer". You could also add criteria into the "Or" field. For example, you might want to search for individuals called either "Homer" or "Barney".
You may need to practice this to get a good understanding of what it can do. Switch back and forth between Design View and Datasheet View as many times as you like. Change the criteria, add some fields, show fields, don't show them...
Once you become familiar with queries, you'll realise the true benefits of database management systems.