Combo Box with a RecordSource and Some text...

  • Thread starter Thread starter Antonio via AccessMonster.com
  • Start date Start date
A

Antonio via AccessMonster.com

Hi,

I'm trying to setup a Combo Box which is unbound and it shows the following
source:

SELECT Year([RegistoData]) AS Period FROM Registo GROUP BY Year([RegistoData])
;

So that I can fill it with the existing possible years in the table. The
result will be 2002, 2003, 2004, and so on.

As this Combo Box will be used for filtering, I would also like to add an
initial default value, that should appear as "All".

I've tried setting the Default Value to "All" but obviously only "#error"
appeared in the combo box...

Anyone?

Thanks
Antonio
 
Antonio via AccessMonster.com said:
Hi,

I'm trying to setup a Combo Box which is unbound and it shows the
following source:

SELECT Year([RegistoData]) AS Period FROM Registo GROUP BY
Year([RegistoData]) ;

So that I can fill it with the existing possible years in the table.
The result will be 2002, 2003, 2004, and so on.

As this Combo Box will be used for filtering, I would also like to
add an initial default value, that should appear as "All".

I've tried setting the Default Value to "All" but obviously only
"#error" appeared in the combo box...

See if this page gives you the pointers you need:

http://www.mvps.org/access/forms/frm0043.htm
Adding "All" to a listbox or combobox
 
Antonio, for your query, I would use:

SELECT DISTINCT Year([RegistoData]) AS Period FROM Registo
I think it will be more efficient than using a group by, but I'm not exactly
sure why, maybe someone else can tell us that.

For your second question, on putting an ALL option in your combo, try
searching google groups for "access combo box all option" and you will get
lots of good info.
hope this helps

-John
 
Back
Top