Options to create data queries in Access 2016
Access 2016 provides several options that allow you to design and run queries to return exactly the information you need. In this article, we will learn how to modify and sort queries in Query Design View, as well as how to use Totals functions to create queries that can compute data. You will also learn more about other query options in Access 2016.
Edit Access 2016 queries
After the query has been created, you can edit query criteria, link between tables, choose to sort, hide fields in query results.
To modify the query you do the following:
When you open an existing query in Access 2016 it will display in the Datasheet View, meaning that you will see the query results returned as tables. To modify the query, you must enter Design View mode. There are two ways to switch to this mode:
Go to Home > View > select Design View in the drop down menu.
In the lower right corner of the Access window, find a small view icon, click Design View at the far right.
When in Design View, change the query as desired, then select Run to update the results.
Sort query results
Access 216 allows you to apply multiple types of arrangements at the same time when designing queries. This helps you see the data exactly the way you want.
A sort option can include one or more of a sorted column called multilevel sort. This sort allows you to sort by a previous criterion, then add the following criteria. For example: If you have a table containing customers and their addresses, you can choose to sort the records by city, then in the alphabetical order of their names.
When there is more than one sorting criteria in the query, Access treats left to right. This means that the arrangement on the left will be applied first. In the example below, customers will be sorted by City first and then Zip Code.
Apply multilevel sort
Open the query, switch to Design View. Find schools that want to arrange ahead. In the Sort: row, click on the drop-down arrow and select the sort of incremental or descending order corresponding to Ascending / Descending.
Repeat the above action for other schools (if needed). Remember, the sort is applied from left to right, so any additional sort must be applied to the fields to the right of your main sort. If necessary, reorder the fields by clicking on the field name and dragging it to the new location.
Click the Run command to apply the sort:
The query results will appear with the sort you created:
If you just want to rearrange the results table without modifying the query, go to Home > Sort & Filter group> click on the Advanced drop-down menu> create manual sort as usual. When finished, click Toggle Filter to apply the sort.
Hide the field in the query
You open Design view, find the field you want to hide, click the checkbox in the Show row : to remove it:
Click Run to update the query results. To re-display the field, repeat the above actions and click the checkbox in the field to create.
Create a gross query (total query)
When working with digital data, returning normal results may not satisfy you. You want to calculate the total number of items sold, the number of customers purchased, the amount of goods sold in the month, what to do? Access provides some functions to work with such digital data:
- Count: Count the total number of items
- Sum: Add values together
- Average: Find the average of the values
- Maximum: Returns the highest value
- Minimum: Returns the lowest value
- First: Returns the first or earliest value
- Last: Returns the last or most recent value
For example:
We want to find the total number of sold items for each category, so we will use the query to display all the items sold, then calculate the total sold for each item.
Create or open a query you want to use to make a composite query. On the Design tab> Show / Hide > Totals group:
A Total row will be added in the design section, with all values in the row being Group By . Select the cell you want to calculate in Total :, a menu will appear:
Select the type of calculation you need, here we choose Sum .
Select Run on Query Tools Design to run the query:
The result returned will be as follows:
Parameter query
A parameter query allows creation of queries that can be easily updated to reflect new criteria, or search terms. When you open the parameter query, Access prompts you for the search term and displays the results for that search.
Query to find duplicates
This type of query allows you to find both duplicate records in the database to delete them. Duplicate records can negatively affect the integrity of the database.
Through these two articles, you know how to create the most basic queries in Access, the next part we will learn about reporting in Access 2016.
Next lesson: Create reports in Access 2016 and use advanced reporting options
Previous article: Create data queries in Access 2016 from simple to complex
You should read it
- Set up Query Criteria in Access 2016
- Alternate Criteria in Access 2016
- Create data queries in Access 2016 from simple to complex
- What do you know about data queries?
- MS Access 2003 - Lesson 22: Using Query Wizards
- Action Query in Action 2016
- MS Access 2003 - Lesson 23: Own query design
- MS Access 2003 - Lesson 21: Chapter 6: Using Query to check data
- Work with data in Access 2016
- Create reports in Access 2016 and use advanced reporting options
- Introduction to databases - Database
- Edit tables in Access 2016
Maybe you are interested
How to implement infinite scrolling and pagination with Next.js and TanStack Query
What is the unauthorized GraphQL query error that causes Facebook Messenger to not work?
The cost per search query with Google and Microsoft chatbots can cost 10 times more than a regular search query
How to access TPM Diagnostics tool to query security data on Windows 11
What is SQL Query Optimization... and Why Does It Matter?
ENCODEURL function - The function returns a query string with URL code in Excel