Solved

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

Posted on 2013-12-13
3
328 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 120

Expert Comment

by:Rey Obrero (Capricorn1)
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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
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…

825 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