Solved

How to add item to a combobox Rowsource (table/query) that is not part of the query statement.

Posted on 2008-10-08
5
463 Views
Last Modified: 2012-05-05
Good Afternoon,

I have a simple ComboBox that queries the items from a table.  Is it possible to programatically add items to that combobox that is not on any field in the table.  The logic behind this is that I'm using the queried items from the table as a means to filter another query.  I'm hoping to add "all" as part of the rowsource on the combobox.

Attached is the simple query:
substr = "SELECT DISTINCT Sub from Questions WHERE Questions.LOB = '" & strind & "' ORDER BY 1 ASC;"

Open in new window

0
Comment
Question by:jad0083
  • 3
5 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 22673865
yes you can use a union query to do that

see this link for example

http://support.microsoft.com/?kbid=210290
0
 
LVL 44

Expert Comment

by:GRayL
ID: 22673877
Try:

Select Distinct Sub from questions etc.
UNION All
Select top 1 'All' From questions;
0
 
LVL 44

Accepted Solution

by:
GRayL earned 500 total points
ID: 22673885
Dumb:

SELECT Distinct Sub FROM questions etc.  - as you had written it
UNION
SELECT "All" FROM questions
0
 

Author Closing Comment

by:jad0083
ID: 31504469
Thanks for the quick solution, exactly what I needed, thanks!
0
 
LVL 44

Expert Comment

by:GRayL
ID: 22674038
Thanks, glad to help.
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
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…
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.

820 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