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
462 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
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…

776 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