?
Solved

Can you have a drop down list in a query

Posted on 2014-03-14
4
Medium Priority
?
1,776 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 2000 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

765 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