Connecting Tech Pros Worldwide Help | Site Map

How to add "All" to a combo-box

  #1  
Old November 12th, 2005, 04:43 PM
Loreen
Guest
 
Posts: n/a
I have been going through user groups and forums for the past 3 hours
trying to figure out how to add "all" to my combo boxes.

I've got two unbound comboboxes. Once only has one field "FiscalYear"
and the other had two "DonationTypeID" and "DonationType". Both
comboboxes have Table/Query as the control RowSourceType and I setup
the RowSource through the query wizard interface.

Using the instructions I found at
http://www.mvps.org/access/forms/frm0043.htm, I went from

SELECT [TBL-zlist-FiscalYear].FiscalYear
FROM [TBL-zlist-FiscalYear]
ORDER BY [TBL-zlist-FiscalYear].FiscalYear;

to:

SELECT [TBL-zlist-FiscalYear].FiscalYear
FROM [TBL-zlist-FiscalYear]
UNION SELECT Null as AllChoice, "(All)" as Bogus From
[TBL-zlist-FiscalYear]
ORDER BY [TBL-zlist-FiscalYear].FiscalYear;

but I can't seem to make it work. I get the error "The number of
columns in the two selected tables or queries of a union query do not
match".

I'm sure this is because this combo only has one field, but I don't
know enough about Union queries or coding to fix it. Any help would
be EXTREMELY APPRECIATED!
Loreen
  #2  
Old November 12th, 2005, 04:43 PM
rkc
Guest
 
Posts: n/a

re: How to add "All" to a combo-box



"Loreen" <Loreen_thurman@yahoo.com> wrote in message
news:9cdffcfc.0311201707.75fc6b89@posting.google.c om...[color=blue]
> I have been going through user groups and forums for the past 3 hours
> trying to figure out how to add "all" to my combo boxes.
>
> I've got two unbound comboboxes. Once only has one field "FiscalYear"
> and the other had two "DonationTypeID" and "DonationType". Both
> comboboxes have Table/Query as the control RowSourceType and I setup
> the RowSource through the query wizard interface.
>
> Using the instructions I found at
> http://www.mvps.org/access/forms/frm0043.htm, I went from
>
> SELECT [TBL-zlist-FiscalYear].FiscalYear
> FROM [TBL-zlist-FiscalYear]
> ORDER BY [TBL-zlist-FiscalYear].FiscalYear;
>
> to:[/color]

Try this:

SELECT [TBL-zlist-FiscalYear].FiscalYear
FROM [TBL-zlist-FiscalYear]
UNION SELECT "(All)" as FiscalYear
From [TBL-zlist-FiscalYear]
ORDER BY [TBL-zlist-FiscalYear].FiscalYear;



Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Determine if query "x" exists nickvans answers 3 January 31st, 2008 05:42 PM
"empid" is undefined or null manojsingh answers 2 June 4th, 2007 03:52 PM
Combobox fun - "Specified argument was out of the range..." Michael Conroy answers 3 November 16th, 2005 08:03 PM
"Catch all" Not Me answers 3 November 12th, 2005 08:22 PM
Add "ALL" to combo shows no records Dale Ring answers 2 November 12th, 2005 04:08 PM