Solved

Combo box displaying ID numbers not the desciption

Posted on 2014-02-09
9
246 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 50

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 50

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
Industry Leaders: 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 50

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

685 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