Query Wizard
By Richard Rost
3 days ago
How to Create Simple Microsoft Access Queries In this lesson, we will walk through creating a simple Microsoft Access query with the Query Wizard by selecting a table, choosing fields, naming the query, and viewing its results. We will also create the same query in Query Design, then discuss using criteria to filter records and sorting to organize the results. PrerequisitesLinksRecommended Courses
Keywords TechHelp Access, Access query wizard, simple select query, query design view, select query criteria, query sorting, filter records by state, credit limit criteria, saved queries, query wizard vs design view, crosstab query, find duplicates query, find unmatched query
Subscribe to Query Wizard
Get notifications when this page is updated
More InformationTranscript Have you got a table full of data, but you only need to see a few fields, maybe a few records, or maybe just the customers who meet a particular condition? That's where queries come in.
And they sound more mysterious than they really are, just like the query wizard. He sounds like he's a mysterious wizard.
Well, we're going to demystify that wizard for you today.
Welcome to another TechHelp video brought to you by Access Learning Zone. I'm your instructor, Richard Rost.
Today, we're going to create a simple query in Microsoft Access using the query wizard. This is especially useful if you're following a class assignment that says, "Use the wizard," or if you're just getting started and want Access to walk you through the process.
Then I'll show you how to build the same kind of query directly in query design, which is the way I prefer to do it without the wizard, which I actually think is faster.
And by the end, you'll understand how to pull useful information out of your tables without making a second copy of all that data.
Now, before we build a query, let's make sure we know what the word query means. It's not mysterious.
Remember, your table is where the actual data lives. In our CustomerT table, we've got information for each customer: name, address, phone number, email, credit limit, and so on.
Now, most of the time, you don't need every field for every customer. Maybe you're making a phone list, or you want to see customers in Florida, or customers with credit limits over $1,000.
That's where a query comes in. It retrieves and organizes information from one or more tables in just the way you want to see it.
A simple select query can show only the fields you want, only the records that meet a certain condition, or put these records in a particular order. Queries are good for all those things.
And remember, a normal saved select query doesn't create a second copy of your customer data. It just saves the instructions for finding it.
So, every time you open the query, Access runs those instructions and shows the current results from the table.
If you want a little more background on what queries are, go watch my "What Is a Query" video first. You'll find a link down below.
All righty, here I am in my TechHelp Free Template. This is a free database. You can grab a copy off my website if you want to, but you can work with any basic Access database.
And in here, I've got a customer table. It's got all my customers, first name, last name, and so on.
Let's say I want to put together a query that just shows their customer ID, first name, and their state, because I don't need to see all this information just for my list of customers by state.
So that's where our query comes in handy.
So I'm going to come up to Create. And if your ribbon isn't staying open, you can just double-click on it, and that'll force it to stay open.
Then I'll click on the Query Wizard.
Now, in Access, there are good wizards and there are bad wizards. Are you a good witch or a bad witch?
Well, this is a good wizard if you're just getting started with Access.
Now, there's four different types of queries on here we can create: Simple, Crosstab, Find Duplicates, and Find Unmatched. We're going to use a Simple Query Wizard today. I'll talk about these other three at the end of the video.
So go ahead and click Simple Query Wizard and hit OK.
That'll bring this guy up.
Now, the first thing you got to do is pick which table or other query you want to get the data for this query from.
So we're just going to pick the Customer table. But yes, you can build queries that are based on other queries. You can get pretty complicated with this stuff, but today we're going to stay simple.
So pick CustomerT, and now you'll see a list of all the fields that are in that table.
So we're going to bring over just the ones we want to have in this query.
So I'm going to click this little button there that'll bring over Customer ID. See, boop, there it goes.
First Name, boop. Or you can double-click on these guys. Double-click, and it brings it over.
This button brings over all the fields if you want them, but for this query, we don't.
And then let's find State. So State's right there, and double-click.
And if you make a mistake and bring over one that you don't need, like Country, well, just click this button here. It'll send it back over there.
All right. So we got the four fields that we want.
Now I'm going to click Next.
Now, this asks for a title for the query. This is actually going to name the query, and I don't like this name.
I don't like this name because I don't like putting spaces in my field names or my table names or my query names. Any of my objects in here, I don't like spaces in there.
I got lots of reasons why. I talk about them in my full course.
So we're just going to rename this to CustomerQ. I like to end all my queries in the letter Q, all my tables in the letter T, my forms in F. And guess what? My reports, those end in R.
So, CustomerQ.
And now, what do you want to do when we're done saving this query? Do you want to open the query and view information, or modify the query's design?
Let's just view the information for now. And then I'll hit Finish.
And there we go. There's our CustomerQ. It saved it right there.
So it's in our navigation pane. It's CustomerQ.
And here's our simple query. It's got Customer ID, First Name, Last Name, and State.
You're done. That was your first query using the Query Wizard.
Now, the beauty of a query is you can close that, save changes, yes, close your database, come back next week, and you want the same list again. You just open up the Customer query, and here's a list of all your customers.
And if someone else, in the meantime, has added records or changed records directly in the Customer table, the next time you run this query, it's going to show the updates.
And also, be careful. This is live data. If you delete Captain Picard, he's deleted from the table. The query is just showing you data that's in the table.
Now, that's the basics of building a simple select query with the Query Wizard. But there's more you can do.
Now, I prefer building my queries directly in query design. Let me show you how to do that. It's actually faster than using the Query Wizard.
So I'm going to come over here and delete that CustomerQ. I'm going to click on it and hit Delete on my keyboard and say yes.
Now, here's how we do the same thing with query design.
Click on Create.
Query Design, this time, gives you a blank query.
Over here, you get Add Tables. We're just going to add the table that we want to go to Tables. Find CustomerT, double-click on it. There's your Customer table.
We can close this down. We don't need that anymore.
We're going to just double-click on the fields we want: Customer ID, First Name, Last Name, and then scroll down and find State.
Or you can click and drag if you like doing it that way.
Save it. Control-S. CustomerQ.
And you're done. That's it.
See how fast that was? Once you understand what you're doing, it's quicker to do it with Design View.
Run through it a couple of times with the Query Wizard, just to make sure you got it. But then, once you're actually ready to start working with queries, that's so much faster.
Now, when you want to run the query and get your results, just click on the little Run over here. So, exclamation point. They call that the bang symbol. BNG, bang.
Click on it. There's your results.
Now, just a little preview of some other stuff you can do with queries. I have other videos where I cover this stuff in more detail, but let me just give you a taste.
If you want to limit your list of customers by state, see this criteria row over here? So you can go to your State and type in Florida, FL, and then press Tab.
See how it puts it in quotes?
Now, when I run the query, look at that. I'm only seeing customers from Florida. The rest of them are still on the table. That's fine. But the query is just filtering them and only showing you the records from Florida.
That's called a query criteria.
Let's go back to Design View. Let's get rid of that.
Let's change it to New York. Same thing.
Run it. Here's my customers from New York.
You can also put sorts on this stuff.
Let me delete that. Notice there's a Sort row right here.
Let's see. You want to sort these by Last Name. Drop this down and pick Ascending.
And then run it.
And now you got all your customers sorted by Last Name. See that?
Let's say you only want to see customers with a credit limit of at least $1,000. How do you do that?
Well, let's go back to Design View. Let's get rid of that sort. Let me just drop this down and pick Not Sorted.
Now, to limit them based on their credit limit, we have to add that field. So find the Credit Limit field right there. Double-click on it.
And for criteria, I'm going to say greater than or equal to 1,000. See those skills from math class when you were in high school? They're coming in handy now.
Now, if I run it, there's only customers with $1,000 or more for their credit limit.
And we can sort it, too. Click, drop this down, sort Descending.
And now you'll see the highest ones up top, and it sorts them down. Same.
All right. So, quick recap.
Tables store the actual information. Queries give you a useful view without creating another copy.
The Simple Query Wizard gives you a guided path. You choose your table or query, select your fields, name the result, and open it.
But Query Design lets you do the same kind of query directly. I think faster and easier. But that's just my opinion.
Once you get used to it, it's much, much better. And you get direct control over the fields, criteria, sorting, and all that stuff.
Now, if you want to learn more about queries, I got a lot of other videos that teach all the different things that I mentioned in today's video in more detail.
This video will teach you more about query criteria.
If you want to learn about those other types of queries that showed up in the wizard, here's a video on crosstab queries.
This video covers find duplicate queries.
This video covers aggregate queries.
And not only can you use queries to select data, but you can also use them to modify data, too. There's update queries, append, delete, and make-table queries.
Yeah, you can use a query to make a whole new table, or delete records, or add records to a table. There's all kinds of cool stuff.
This video talks about it in more detail.
And of course, if you're just getting started with Microsoft Access, check out my Access Beginner 1 course. It's four hours long. It's absolutely free, and it will teach you all of the basics of getting started and working with Microsoft Access.
We go through building tables, queries, forms, reports, and lots more.
Check it out. It's on my YouTube channel. It's on my website. There's the link right there. I'll put a link down below.
And if you have any questions, feel free to post them in the comments.
But there you go. Now you know how to use the Query Wizard.
Like I said, he's a good wizard.
And that is going to be your TechHelp video for today.
I hope you learned something.
Live long and prosper, my friends. I'll see you next time. Intro In this lesson, we will walk through creating a simple Microsoft Access query with the Query Wizard by selecting a table, choosing fields, naming the query, and viewing its results. We will also create the same query in Query Design, then discuss using criteria to filter records and sorting to organize the results. Quiz Q1. What is the main purpose of a select query in Microsoft Access? A. To retrieve and organize data from one or more tables B. To permanently replace the data in a table C. To create a backup copy of every record D. To prevent users from viewing table data
Q2. Does a normal saved select query create a second copy of the table data? A. Yes, it duplicates all records in a new table B. Yes, but only for selected fields C. No, it saves instructions for retrieving current data D. No, because it permanently moves the data to the query
Q3. Which query type should be selected in the Query Wizard to choose fields from a table and display matching records? A. Simple Query Wizard B. Crosstab Query Wizard C. Find Duplicates Query Wizard D. Find Unmatched Query Wizard
Q4. What can you select as the data source when creating a query with the Query Wizard? A. Only one table B. A table or another query C. Only a form D. Only a report
Q5. What is the purpose of selecting specific fields in a query? A. To display only the information needed B. To delete fields that are not selected C. To encrypt the selected fields D. To convert fields into calculated controls
Q6. What is one advantage of creating a query in Query Design instead of using the Query Wizard? A. It gives direct control over fields, criteria, and sorting B. It automatically prevents records from being edited C. It creates a separate copy of the source table D. It can only be used with one field at a time
Q7. What is the purpose of the Criteria row in Query Design? A. To filter records based on conditions B. To rename the query C. To select a primary key D. To save the query automatically
Q8. Which criterion would limit results to customers whose State field is FL? A. FL B. >= FL C. State = True D. Sort FL
Q9. If a query should show only customers with a credit limit of at least 1000, which criterion should be used for the Credit Limit field? A. <= 1000 B. = 1000 C. >= 1000 D. <> 1000
Q10. If you use the Sort row with Descending on the Credit Limit field, how will the results appear? A. Lowest credit limits first B. Highest credit limits first C. Only records with blank credit limits D. Records grouped by state only
Q11. What happens if you delete a record while viewing an editable select query? A. The record is deleted from the underlying table B. The record is hidden temporarily but remains in the table C. Only the query is deleted D. Access automatically restores the record when the query closes
Q12. Why might you include a field in a query grid even if you do not need to display it? A. To use it for criteria or sorting B. To make it the primary key C. To convert it into a table D. To make the query read-only
Answers: 1-A; 2-C; 3-A; 4-B; 5-A; 6-A; 7-A; 8-A; 9-C; 10-B; 11-A; 12-A
DISCLAIMER: Quiz questions are AI generated. If you find any that are wrong, don't make sense, or aren't related to the video topic at hand, then please post a comment and let me know. Thanks. Summary Today's video from Access Learning Zone explains how to create a simple select query in Microsoft Access using the Query Wizard. I will also show you how to create the same query directly in Query Design, which is the method I generally prefer once you understand the basics.
Queries are not as mysterious as they sound. A table is where your actual data is stored. For example, a CustomerT table might contain each customer's name, address, phone number, email address, credit limit, state, and other information.
Most of the time, you do not need to see every field for every customer. You might need a simple phone list, a list of customers in a particular state, or a list of customers whose credit limits exceed a certain amount. A query allows you to retrieve and organize information from one or more tables in the exact format you need.
A basic select query can display only the fields you choose, show only records that meet certain conditions, and sort records in a particular order. A saved select query does not create a second copy of your data. Instead, it saves the instructions Access uses to locate and display the data. Every time you open the query, Access retrieves the current information from the underlying table.
To create a query with the Query Wizard, begin on the Create tab and select Query Wizard. Access provides several different query wizards, including Simple Query, Crosstab Query, Find Duplicates Query, and Find Unmatched Query. For this example, use the Simple Query Wizard.
The wizard first asks which table or query will provide the data. Select CustomerT. You can create queries based on tables or other queries, although it is best to start with a simple table-based query while learning.
After selecting CustomerT, Access displays the available fields in that table. Move the fields you want into the selected fields list. For a basic customer list, select CustomerID, FirstName, LastName, and State. If you accidentally add a field you do not need, remove it from the selected list before continuing.
Next, provide a name for the query. I recommend using a consistent naming convention for database objects. For example, I use T at the end of table names, Q at the end of query names, F for forms, and R for reports. In this example, name the query CustomerQ.
The wizard then gives you the choice of opening the query to view the results or modifying the query design. Choose to view the results and finish the wizard. Access saves the query in the Navigation Pane under the name CustomerQ.
When you open CustomerQ, you will see only the selected fields: CustomerID, FirstName, LastName, and State. The query displays live data from CustomerT. If someone adds or changes a customer record in the table, those changes will appear the next time you open the query.
It is important to remember that a select query is displaying the real table data. If you edit or delete a record while viewing an editable query, you are changing or deleting the original table record. For example, deleting a customer from the query result deletes that customer from the underlying table.
The Query Wizard is useful when you are new to Access or when an assignment specifically requires you to use it. However, once you are comfortable with queries, Query Design is usually faster and gives you more control.
To create the same query directly in Query Design, begin on the Create tab and select Query Design. Access opens a blank query and prompts you to add tables or queries. Add CustomerT to the design window.
From the CustomerT field list, add CustomerID, FirstName, LastName, and State to the query design grid. You can add fields by double-clicking them or by dragging them into the grid. Save the query as CustomerQ.
To view the results, run the query. The result will be the same as the query created with the wizard: a list showing the customer ID, first name, last name, and state for each customer.
Query Design becomes especially useful when you want to filter or sort your records.
For example, suppose you only want to see customers who live in Florida. In the Criteria row under the State field, enter FL. When you run the query, Access displays only records where the State field is FL. The other customers still exist in CustomerT. The query is simply filtering the records that are displayed.
You could change the criteria to NY to display only customers from New York. This type of filtering is called query criteria.
You can also sort the records. If you want to arrange the results alphabetically by last name, set the Sort row under the LastName field to Ascending. When you run the query, Access displays the customers in alphabetical order by last name.
Another common task is filtering records based on a numeric value. Suppose you want to see only customers with a credit limit of at least $1,000. Add the CreditLimit field to the query design grid. In the Criteria row for that field, enter a condition that specifies values greater than or equal to 1000.
When you run the query, Access displays only customers whose credit limits meet that requirement. You can also sort the CreditLimit field in descending order to place customers with the highest credit limits at the top of the list.
The important idea to remember is that tables store the actual information, while queries provide useful views of that information. The Simple Query Wizard gives you a guided way to select a table, choose fields, name the query, and view the results. Query Design lets you create the same type of query more directly while also giving you control over criteria, sorting, calculated fields, and many other options.
Access also supports other kinds of queries. Crosstab queries summarize data in a spreadsheet-like layout. Find Duplicates queries help locate repeated values. Find Unmatched queries identify records in one table that do not have related records in another table. Aggregate queries can total, count, average, and otherwise summarize information.
Queries are not limited to selecting and viewing data. Action queries can update records, append records to another table, delete records, or create a new table from query results. These tools are powerful, so it is important to understand how they work before using them on important data.
If you are new to Microsoft Access, my Access Beginner 1 course covers the fundamentals of working with tables, queries, forms, reports, and other essential database features.
You can find a complete video tutorial with step-by-step instructions on everything discussed here on my website at the link below. Live long and prosper, my friends. Topic List What Microsoft Access queries do Creating a simple query with Query Wizard Selecting table fields for a query Naming and saving a select query Viewing live query results Creating a query in Design View Adding fields in Query Design Running a query Filtering records with query criteria Sorting query results Filtering by numeric values Article A query in Microsoft Access is a way to view and organize data from one or more tables without creating a separate copy of that data. The table remains the place where the actual records are stored. A query simply saves instructions that tell Access which records and fields to display, how to filter them, and how to sort them.
For example, a CustomerT table might contain customer ID, first name, last name, address, state, phone number, email address, and credit limit. If you only need a list showing each customer's ID, name, and state, a query can display only those fields. If someone later adds or changes a customer in the table, the query will show the updated information the next time you open or run it.
Keep in mind that a normal select query displays live table data. If you edit or delete a record while viewing the query, you may be editing or deleting the original record in the underlying table. The query does not normally create a protected copy of the data.
One way to create a basic query is with the Simple Query Wizard. Start by selecting Create on the ribbon and then choose Query Wizard. Select Simple Query Wizard and click OK.
Access will ask which table or existing query should supply the data. Choose CustomerT, or whichever table contains the information you need. You will then see a list of available fields on the left and selected fields on the right.
Move the fields you want into the selected list. You can use the arrow buttons or double-click a field name. For a customer list, you might choose CustomerID, FirstName, LastName, and State. If you accidentally add a field you do not need, select it from the chosen fields list and move it back.
Click Next when you have selected the desired fields. Access will ask you to name the query. Choose a meaningful name, such as CustomerQ. A consistent naming convention can make a database easier to manage. For example, some people use T at the end of table names, Q for queries, F for forms, and R for reports.
Choose the option to open the query and view the results, then click Finish. Access creates and saves the query. When you open it, you will see only the fields you selected. The query will also appear in the Navigation Pane, where you can open it again whenever you need the same view of the data.
Although the wizard is useful when you are learning, many people prefer creating queries directly in Query Design because it gives you more control and is often faster once you understand the basics.
To create the same query in Query Design, select Create and then Query Design. Access opens a blank query and displays the Add Tables window. Select CustomerT and add it to the query. You can then close the Add Tables window.
The CustomerT field list appears in the upper part of the design window. Double-click each field you want in the query, such as CustomerID, FirstName, LastName, and State. Each selected field appears in a column in the design grid at the bottom of the window.
Save the query with a meaningful name, such as CustomerQ. To view the results, click Run, represented by an exclamation point on the Query Design ribbon. Access switches to Datasheet View and displays the records returned by the query.
Query Design also lets you add criteria, which are conditions that determine which records appear in the results. For example, if you only want customers in Florida, add the State field to the design grid and type FL in the Criteria row under that field. When you run the query, Access displays only records where the State field is FL. The customer records in other states remain in the table; they are simply excluded from this particular query result.
You can change the criterion to another value whenever necessary. For example, entering NY in the State criteria displays only customers from New York. Text criteria are normally shown in quotation marks by Access, but you can usually type the text value directly.
Queries can also sort records. In the Sort row for the LastName field, choose Ascending to list customers alphabetically by last name. Choose Descending if you want the reverse order. Sorting changes the order of the query results, not the order in which records are physically stored in the table.
You can filter records using numeric conditions as well. Suppose you want to see only customers whose credit limit is at least 1000. Add the CreditLimit field to the design grid and enter >=1000 in the Criteria row. The greater-than-or-equal-to operator tells Access to return records with a credit limit of 1000 or more.
You can sort those results by credit limit by choosing Descending in the Sort row under CreditLimit. This places the customers with the highest credit limits at the top of the result list.
If you use a field only for filtering or sorting and do not want it displayed in the final results, clear the Show checkbox in that field's column. For example, you could filter customers based on CreditLimit but hide the CreditLimit column if the final list only needs names and states.
Tables store your data, while queries provide useful views of that data. The Simple Query Wizard offers an easy guided way to create a basic select query. Query Design provides more direct control over field selection, criteria, sorting, and whether a field is displayed. Once you understand the design grid, queries become one of the most practical tools in Microsoft Access for finding exactly the information you need. Primary Topics Access select queries, Simple Query Wizard, Query Design view, selecting fields, saved queries, query criteria, sorting query results, live table data Secondary Topics naming conventions for database objects, queries based on other queries, running queries, editing data through query results
|