New Feature: Playlist Center! Pick a topic and let our playlists guide the way.

Start learning with our library of video tutorials taught by experts. Get started

Access 2010: Queries in Depth
Illustration by Neil Webb

Creating a combo box


From:

Access 2010: Queries in Depth

with Adam Wilbert

Video: Creating a combo box

In the last movie we look at how we could take the value from a drop-down menu on a form and use it as a criteria and a query. In this movie, I want to take a quick look at how the combo box was created and how the state names are populated in the drop-down list. I've currently got that form frm_ EmployeeLookup opened. Let's go ahead and switch into Design view. We'll take a look at the Properties for this form by clicking on the object. If it is not open, you can open up the Property Sheet and then we'll switch to the Data tab. We can see that the Row Source for this particular object includes this long code.
Expand all | Collapse all
  1. 9m 9s
    1. Welcome
      1m 10s
    2. Using the exercise files
      41s
    3. Introducing the database
      4m 29s
    4. Previewing the course
      2m 49s
  2. 17m 17s
    1. Understanding queries
      3m 31s
    2. Following naming conventions and best practices
      2m 56s
    3. Using the Query Wizard
      5m 21s
    4. Exploring the design interface
      5m 29s
  3. 26m 39s
    1. Defining criteria
      5m 40s
    2. Understanding comparison operators
      3m 19s
    3. Defining the column headers
      2m 49s
    4. Exploring the property sheet
      7m 32s
    5. Printing query results
      2m 41s
    6. Working with joins
      4m 38s
  4. 14m 14s
    1. Understanding parameter queries
      4m 27s
    2. Obtaining parameters from forms
      5m 17s
    3. Creating a combo box
      4m 30s
  5. 23m 24s
    1. Understanding the Totals field
      5m 31s
    2. Creating aggregate calculations
      3m 31s
    3. Exploring the Expression Builder interface
      4m 28s
    4. Using mathematical operators
      5m 46s
    5. Applying text functions
      4m 8s
  6. 24m 23s
    1. Understanding dates as serial numbers
      2m 42s
    2. Specifying a range of dates or times
      3m 47s
    3. Formatting dates
      4m 31s
    4. Using other Date/Time functions
      3m 47s
    5. Defining today's date
      2m 41s
    6. Calculating time intervals
      6m 55s
  7. 20m 9s
    1. Introducing the conditional IIf function
      2m 57s
    2. Creating an IIf function
      7m 31s
    3. Nesting IIf functions
      4m 57s
    4. Using the Switch function
      4m 44s
  8. 20m 41s
    1. Understanding the reporting tool
      2m 13s
    2. Building the form
      6m 57s
    3. Building the query
      5m 4s
    4. Building the report
      3m 30s
    5. Finalizing the reporting tool
      2m 57s
  9. 25m 37s
    1. Finding duplicate records
      2m 17s
    2. Identifying unmatched records
      2m 29s
    3. Creating crosstab results
      2m 57s
    4. Creating backups
      1m 29s
    5. Creating update queries
      3m 22s
    6. Making, deleting, and appending records
      5m 36s
    7. Uniting tables
      3m 16s
    8. Embedding SQL code in queries
      4m 11s
  10. 1m 0s
    1. Next Steps
      1m 0s

Watch this entire course now—plus get access to every course in the library. Each course includes high-quality videos taught by expert instructors.

Become a member
please wait ...
Access 2010: Queries in Depth
3h 2m Intermediate Jun 16, 2011

Viewers: in countries Watching now:

In this course, author Adam Wilbert illustrates how to create and leverage real-world queries and turn raw data into usable information. The course covers setting up queries, performing calculations, using the built-in Access functions to further refine query results, and identifying top performers or areas for improvement based on a range of criteria.

Topics include:
  • Naming conventions and best practices
  • Working with joins
  • Using comparison operators
  • Defining criteria for select queries
  • Creating parameter queries
  • Creating calculated fields
  • Working with dates and times
  • Using the Expression Builder
  • Creating conditional statements
  • Making, deleting and appending records
  • Building reports
Subjects:
Business Databases
Software:
Access Office
Author:
Adam Wilbert

Creating a combo box

In the last movie we look at how we could take the value from a drop-down menu on a form and use it as a criteria and a query. In this movie, I want to take a quick look at how the combo box was created and how the state names are populated in the drop-down list. I've currently got that form frm_ EmployeeLookup opened. Let's go ahead and switch into Design view. We'll take a look at the Properties for this form by clicking on the object. If it is not open, you can open up the Property Sheet and then we'll switch to the Data tab. We can see that the Row Source for this particular object includes this long code.

Now I can see that the select statement here indicate that this is a query in SQL view. If I click on the Build button we'll open the same query in the Query Design window. Now this query is embedded in the form. You won't find it anywhere in the navigation pane. I can run the query to see the results that are being returned and we notice that we have a column for the abbreviation for the state and the state name. Let's take a look at this in Design view again. So the query that's populating the drop- down menu is using the table States. From that we've got a field for the abbreviation and the field for the state name.

We're also using a second field of the StateName to sort it ascending, but we're not showing it, so this is providing the alphabetical list. Now this brings up an interesting question. In the drop-down menu we only see the full state nam. We're not seeing the abbreviation and now that we're thinking about it, how do the full state name in the form match up to the abbreviated state name that the query returned? Let's run that query again so you can see what I'm saying. We'll close this query, we'll return to the Form view, and we will run our form. I'll go ahead and select Colorado.

We'll run our query and we'll see that Access is matching the full state Colorado to the query with the abbreviated state CO. So what's going on here? Both of these questions can be answered by taking a look at the default way that the Combo Box Wizard creates an embedded query. Let's go to the wizard and create another combo box to see what's going on. We'll go back to the form and switch into Design view. We'll take our combo box object, click on that once, and we'll set a second combo box anywhere in the form.

If you click once, the Combo Box Wizard will open. Now the first step here is to create the combo box and it'll get the values from another table or query. We'll go ahead and say Next. We'll select our States table here and say Next. Access will ask us what fields from the states contain the values you want to include in the box? Let select Abbreviation and StateName. We add that to the Selected Fields and say Next. You can go ahead and sort ascending by StateName to provide the alphabetical list and we'll say Next again.

Finally here's where the answer is. By default Access hides the key column. If you turn that off Access will display the key column. Let's go ahead and leave ours on. We'll go ahead and say Next. Go ahead and select StateName from the Available Fields to show in the combo box. And we'll say Next and we'll just accept the default name. Press Finish. Let's take a look at this combo box and see how it differs from the one we created previously. We will go into Form view, use the new combo box, and because we decided not to show the abbreviated field, we're getting both here in the drop-down menu.

I can select one and Access displays the first column only in the drop-down menu. So with the ID column hidden, which is Access' recommended option in the wizard, the state name is displayed while the value of the combo box remains linked to the hidden abbreviation. When the query runs it grabs the value of the combo box, not necessarily what's being displayed to the user. Now obviously this could be pretty confusing behavior, which is why I recommend building the embedded query manually as we'll see in Chapter 7. But now that we know that the abbreviation field is simply hidden, we can go back to our original dropdown menu and reveal it with a simple tweak to its properties.

We'll go back into Design view, we'll take a look at the properties for the first drop-down menu, and under the Format tab we'll look for this Column Widths section. We'll see that we have two values here. The first one is 0, the second one is 1. Let's change 0 to 0.5. Click off of it to save that value, switch back into Form view, and now we can see that in our dropdown menu we've revealed both the abbreviation and the full name for the state. So we can see that the value of the box, the abbreviated field, was always there.

It just wasn't displayed; it had a zero width. So that's how we managed to link the full name of the state to the abbreviation in the query. All of this is thanks to the default recommended behavior of the Combo Box Wizard.

There are currently no FAQs about Access 2010: Queries in Depth.

 
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.
Upgrade now


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

join now Upgrade now

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Access 2010: Queries in Depth.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.