Solved

Combo box displaying ID numbers not the desciption

Posted on 2014-02-09
9
234 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 48

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 48

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
 

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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

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

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now