Solved

MS Access lookup values in query / form

Posted on 2014-03-11
5
3,566 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
[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
  • 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 500 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
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…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

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