Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Combo box displaying ID numbers not the desciption

Posted on 2014-02-09
9
Medium Priority
?
252 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
  • 6
  • 3
9 Comments
 
LVL 53

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 53

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
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!

 

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 53

Accepted Solution

by:
Rgonzo1971 earned 2000 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

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

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 …
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
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…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

916 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