ReluctantDataGuy
Programmer
I've seen code solutions for populating Combo Boxes and including an "ALL" selection, but I wanted to use a Select statement. I think I have a pretty good cludge here but I'm wondering if anyone has a better solution - ie: that doesn't require a table as my solution does.
I made a table (zzzthat has two fields: Fld1 and Fld1
The table has one row: Fld1 = -1, Fld2 = "ALL"
Originally I had the following Select statement for my combo box:
SELECT zzzType.TypeId, zzzType.TypeCode FROM zzzType ORDER BY zzType.TypeCode;
I changed it to the following:
SELECT zzzComboAdd.Fld1 AS TypeId, zzzComboAdd.Fld2 AS TypeCode FROM zzzComboAdd UNION SELECT zzzType.TypeId, zzzType.TypeCode FROM zzzType ORDER BY TypeCode;
It works great, and it'll work for all of the combo boxes in my appication simply by changing the field names in the first table of the union query.
Problem is, I hate the fact that I have to use a table. Seems like there should be a Select statement that doesn't require the extra table.
Any ideas?
I made a table (zzzthat has two fields: Fld1 and Fld1
The table has one row: Fld1 = -1, Fld2 = "ALL"
Originally I had the following Select statement for my combo box:
SELECT zzzType.TypeId, zzzType.TypeCode FROM zzzType ORDER BY zzType.TypeCode;
I changed it to the following:
SELECT zzzComboAdd.Fld1 AS TypeId, zzzComboAdd.Fld2 AS TypeCode FROM zzzComboAdd UNION SELECT zzzType.TypeId, zzzType.TypeCode FROM zzzType ORDER BY TypeCode;
It works great, and it'll work for all of the combo boxes in my appication simply by changing the field names in the first table of the union query.
Problem is, I hate the fact that I have to use a table. Seems like there should be a Select statement that doesn't require the extra table.
Any ideas?