Solved

Add "ALL" to list, not showing up in ACCESS 200 Table/Query statement

Posted on 2013-12-13
3
325 Views
Last Modified: 2013-12-13
I have the below and even if no data is in the table, I want the combobox to at leas show the term "[All]J".  However, while it works in two other comboboxes, I cannot get this one to display the [All] term even if there is no data from the other union statement.

SELECT "[All]" As ProjectFullID, "[All]" As ProjectName, "[All]" As ProjectID From tblProjects
UNION
SELECT tblProjectFTE.ProjectFullId, tblProjectFTE.ProjectName, tblProjectFTE.ProjectID
FROM tblProjects INNER JOIN tblProjectFTE ON tblProjects.ProjectID = tblProjectFTE.ProjectID
WHERE (((tblProjects.Status) Not In ("Closed","Excluded")));
0
Comment
Question by:ssmith94015
3 Comments
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 39717770
if ProjectFullId and ProjectID is numeric

SELECT 0 As ProjectFullID, "<All>" As ProjectName, 0 As ProjectID From tblProjects
UNION
SELECT tblProjectFTE.ProjectFullId, tblProjectFTE.ProjectName, tblProjectFTE.ProjectID
FROM tblProjects INNER JOIN tblProjectFTE ON tblProjects.ProjectID = tblProjectFTE.ProjectID
WHERE (((tblProjects.Status) Not In ("Closed","Excluded")));
0
 
LVL 40

Accepted Solution

by:
Vadim Rapp earned 500 total points
ID: 39717776
It will happen if you select (anything, including an expression) from tblprojects, but tblProjects has no rows.

Create separate table with one row and select 'all' from that table.

In SQL Server you can select <something> without FROM, but in Access you have to select from table or from query.
0
 

Author Closing Comment

by:ssmith94015
ID: 39717800
That was it, there were no rows in the table!  I did not even think of that.  I put a seed row in and it works now.  Thank you,
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
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…

760 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

18 Experts available now in Live!

Get 1:1 Help Now