Create a select query
A select query helps you get just the data you need in a Datasheet view. The Product table in the top of the picture below has multiple columns, but with a select query, you can get an uncluttered view that focuses on just the columns you need.
You can also add criteria to filter the number of rows returned. For example, find only those products that cost more than $10.00.
Tip: A select query also works well when you need to pull data from several related tables, group data, or to calculate totals.
In this article, we'll see how to create a simple select query in both desktop databases and Access apps.
Create a select query in a desktop database
For example, in a desktop database with a Products table, to see only the product names and the price for each product, you can create a select using the Query Wizard: On the Create tab, click Query Wizard and let the wizard walk you through the process of creating and running the query.
However, if you want to add criteria to your query, use the query designer:
-
Click Create > Query Design.
-
In the Show Table box, double-click the Products table > Close.
-
To add the fields to the design grid, double-click the Product Name and List Price fields.
-
In the criteria row, under List Price add a criteria. For example, >=10 to show a list of products more than or equal to $10.00.
-
To see the query results, on the Design tab, click Run.
Create a select query in an Access app
Creating the same select query in a web-based Access app is similar to the procedure above, with just a little extra bit of work to make the query results available in the browser:
-
Click Home > Advanced > Query.
-
In the Show Table box, double-click the Productstable > Close.
-
To add the fields to the design grid, in the Products box, double-click Product Name and List Price.
-
Right-click the query tab > Save and give your query a name.
-
To see the query results, right-click the query tab > Datasheet View.
To make the query results available on the browser view, you need to add a view of the query to the source table (Product table):
-
Select the Products table.
-
Click the plus icon, enter a view name, and select Datasheet from the View Type drop-down.
-
In the Record Source drop-down, select the query that you want displayed, and click Add New View.
Tip: If you used multiple tables in a query, you can add the view to any or all tables.
No comments:
Post a Comment