[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

MS Access lookup values in query / form

Posted on 2014-03-11
5
Medium Priority
?
3,898 Views
Last Modified: 2014-03-11
Haven't used MS Access for a while and can't figure this out:

I have a products table that has two columns - "ProductID" (pk) and "Product"

I have an Orders table that contains a lookup column "Product(s)" that uses the rowsource "SELECT Products.ProductID, Products.Product FROM Products;" its Bound col 1, column count 2 and col widths 0;2.54cm

This all works fine.

I then have created a query that filters the order table by customerID.

This works fine - when I view the query I see required columns, including the "Product(s)" lookup column that shows a list of the product names.

As an example in the Product(s) field I will see "Design, Marketing, Brochure"

However, when I try to use this query in a form (continuous form view) it only shows the productID's in the lookup box not the Product(names) I see in the query?

i.e. it now shows "1,3,4"

How can I make it so that the "Product" column (product names) show and not the ProductID field?

Many thanks,

Sam
0
Comment
Question by:SamB
  • 2
  • 2
5 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39920357
create a query, using the Orders table with a join in Products table field ProductID
choose all the fields that you need from the Orders table AND to show the Product description, include in your column the Product field from the Products table.


select Orders.*, Products.Product
From Orders Inner join Products on Orders.ProductID=Products.ProductID
0
 
LVL 58
ID: 39920388
Check the control in the form.  It should be a combo and have the same settings that you set for the lookup.

There's not need to include the product table in the forms base query unless you don't want to use a combo control for some reason.

Jim.
0
 
LVL 1

Author Comment

by:SamB
ID: 39920463
Can't get either solution to work.

I've attached the demo database .....

You'll see the query shows the info I need but the form reverts back to ID's only ?

Many thanks,

Sam
Database.accdb
0
 
LVL 58

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 2000 total points
ID: 39920827
Sam,

 Doesn't look like you tried either?

  The form currently has a text box, not a combo box and it's bound to "Product(s)" (which BTW is a bad field name - stay away from any type of special characters in field names).

 You either need to change the control to a combo box, in which case you will be able to set things just as you did for the lookup properties

 or

 you need to do what Ray suggested and include the products table and the description field in the forms underlying query.

If the intent is to add/edit with this form, then the combo box is probably the best, but you still can do it either way.   If you follow Ray's suggestion, you'll need two text controls; one for the product key and then one to display the description.

Jim.
0
 
LVL 1

Author Closing Comment

by:SamB
ID: 39920991
Thanks Jim.

I had changed to a combobox but didn't work - on further investigation I had left the 'Column Count' property at '1' and not updated to '2'. Once did this your solution worked.
0

Featured Post

Technology Partners: 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

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
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…

867 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