Solved

Combo box displaying ID numbers not the desciption

Posted on 2014-02-09
9
250 Views
Last Modified: 2014-02-19
Please see the code.  It is pulling the ID numbers not the description.  What do I need to change in this SQL statement.

SELECT DISTINCT [CG Info].Products, [CG Info].Products, [Forms]![Contact Form]![select] AS Expr1
FROM [CG Info]
WHERE ((([Forms]![Contact Form]![select]) Is Null Or ([Forms]![Contact Form]![select])=[Targeting]))
ORDER BY [CG Info].Products;

Open in new window

0
Comment
Question by:lehi52
[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
  • 6
  • 3
9 Comments
 
LVL 52

Expert Comment

by:Rgonzo1971
ID: 39846528
Hi,

You pull [CG Info].Products twice what is it?

Regards
0
 

Author Comment

by:lehi52
ID: 39846531
Its quite possible bad code.  Here is the sample database.  Look at the contact form. It is the top middle combo box.
1.accdb
0
 
LVL 52

Expert Comment

by:Rgonzo1971
ID: 39846606
HI,

pls try
SELECT DISTINCT products.Products, [Forms]![Contact Form]![select] AS Expr1
FROM products INNER JOIN (Targeting INNER JOIN [CG Info] ON Targeting.ID = [CG Info].Targeting) ON products.ID = [CG Info].Products
WHERE ((([Forms]![Contact Form]![select]) Is Null Or ([Forms]![Contact Form]![select])=[Targeting]![ID]));

Open in new window

Regards
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:lehi52
ID: 39847477
That works on the second box.  But once I made that change the third box doesnt work any longer.
0
 

Author Comment

by:lehi52
ID: 39847482
Here is the database.  See the third box not pulling the results now.
2.accdb
0
 
LVL 52

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 39847510
Hi,

like in the first a join was missing

SELECT [CG Info].ContactID, [CG Info].[Policy Name], [Forms]![Contact Form]![productselect] AS Expr1
FROM products INNER JOIN [CG Info] ON products.ID = [CG Info].Products
WHERE ((([Forms]![Contact Form]![productselect]) Is Null Or ([Forms]![Contact Form]![productselect])=[Products].[Products]))
ORDER BY [CG Info].[Policy Name];

Open in new window

Regards
3.accdb
0
 

Author Closing Comment

by:lehi52
ID: 39847647
Thank you.
0
 

Author Comment

by:lehi52
ID: 39848007
Now I changed something and I am having the issue again. I am sure it is a quick fix.  See the attached database.
0
 

Author Comment

by:lehi52
ID: 39848012
Ill post a new question about this.  I shouldnt add on to an already closed topic.  The issue is I changed the combo box so it doesnt show up on each tab.  Then I thought I used all the same criteria as the previous one and now it shows the id numbers on the last combo box.
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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
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…

632 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