Solved

Can you have a drop down list in a query

Posted on 2014-03-14
4
1,605 Views
Last Modified: 2014-03-26
I have table called Table.  My table has two fields Cars and Year.
Is there a way to create a query with the two fields and have a dropdown list to select the Year?
0
Comment
Question by:Conernesto
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 85
ID: 39930131
If you have a Dropdown in the underlying table you could do this - but that's a bad idea for many reasons, not the least of which is a query should not be used for something of this nature.

Create a form, and set it to Datasheew view. It'll look like a query but act like a form.
0
 
LVL 7

Expert Comment

by:COACHMAN99
ID: 39930719
using year as a column name is bad (reserved word/function) - change to yearx

1.set rowsource = select cars, yearx ...
2. set dropdown to 2 columns, bound column = 1, column widths = 0;2
This will hide the year and display the car.
if you want to see year and car then
select yearx, (yearx & ' - ' & car) as carx ...
and do same as 2 above.
0
 

Author Comment

by:Conernesto
ID: 39957380
How do I do the above steps? (i.e. set rowsource and so on)

Thank you.
0
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 39957431
As I said in my first post:

Add a dropdown to the underlying table, and your combo will show in the query.

1. Open your table in design view
2. select the column where you want the combo to appear
3. Below the field grid, click the "Lookup" tab
4. Set the various properties of that to show the data you want to show.
5. Now use the table in a query, and select the field from Step 2.

After doing that, the query should show the dropdown.

The "various properties" are what coachmann99 is referring to. You'll see them in the "Lookup" tab:

RowSource is a table or query (or SQL statement) that you use to define the values you'll see in the dropdown.

ColumnCount defines the number of columns that are included in the dropdown (generally that's 2, but it could be more)

ColumnWidths allow you to show/hide columns. This is a semicolon delimited set of numbers. A value of "0;1" would hide the first column and set the width of the second to 1 in.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

689 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question