- 1
Open Microsoft Access. Click on the "Create" tab at the top of the page. Select the "Design View" icon in the upper right-hand part of the screen. Add the table or tables you'd like to query by clicking on them. Close the dialog box.
- 2
Choose the variables within the table or tables you've selected by clicking on them. The variables will appear in the query grid. Use the "Criteria" row in the query grid to limit the results of your query. For example, if you have a "State" field and only want to see data from Texas or California, type "Texas" in the first criteria row, and "California" in the second.
- 3
Use wild cards in the "Criteria" row as necessary. For example, if you're looking for information about a customer whose last name is Riley but you're not sure of the spelling--is it "Riley," "Reilly" or another variation?--type "R*ly." The asterisk basically tells Access to limit the query to all fields that begin with "R" and end with "ly." Do the same for companies; a "Criteria" row entry reading IBM*, for example, will return values of IBM Corp., IBM Corporation, etc.
- 4
Use the "View" icon and pull-down menu in the upper left-hand side of the screen to select "SQL View" when you're trying to set criteria that includes more than 1,024 characters. If you don't know SQL, simply type in a few criteria and save your query. Then, go into the "SQL View" and follow the general style, starting with the "WHERE" statement. Run your query by clicking on the "Run" icon, shown as a red exclamation mark at the top of the page.
- 5
Save your query, either by clicking on the "Office" button in the upper left-hand corner and selecting "Save," or by trying to close the query. A dialog box will appear asking if you want to save your query. Click "Yes" and assign a name to it.
5/15/11
How to Access and Query Multiple Criteria Changes
Being able to query data for multiple criteria is one of the most useful and powerful functions of structured query language, or SQL, the programming language that powers Microsoft Access queries. SQL allows you to select data based on more than one criterion in a variable. The language also lets you select more than one variable to set criteria. Although the query grid used in Access limits criteria to 1,024 characters per field, users with a working knowledge of the query language can use the "SQL View" in Access to create an almost infinite number of criteria.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment