Row Source

  • Thread starter Thread starter Jason Gyetko
  • Start date Start date
J

Jason Gyetko

I have a combo box which is running a select statement in the row source to
retrieve the data which is displayed when the arrow is clicked. Is there a
way for me to add 'ZZ' as the last record of the data returned from the sql
statement. I'm trying to get around adding a 'ZZ' record in the table for
every combination that the sql statement will encounter, so I just want it
hard-coded at the end. Thanks.
 
Jason said:
I have a combo box which is running a select statement in the row source to
retrieve the data which is displayed when the arrow is clicked. Is there a
way for me to add 'ZZ' as the last record of the data returned from the sql
statement. I'm trying to get around adding a 'ZZ' record in the table for
every combination that the sql statement will encounter, so I just want it
hard-coded at the end.


You can use a UNION query to add things to a query. When
you do this, it's more efficient to use a table with one row
so Access doesn't have to go to the trouble of comparing all
the records to eliminate duplicates.

Your query would then look like:

SELECT whatever
FROM yourtable
WHERE whatever
UNION (or UNION ALL)
SELECT "ZZ", 2,3, ...
FROM onerowtable
ORDER BY ...
 
Thanks, that's exaclty what I needed.

Marshall Barton said:
You can use a UNION query to add things to a query. When
you do this, it's more efficient to use a table with one row
so Access doesn't have to go to the trouble of comparing all
the records to eliminate duplicates.

Your query would then look like:

SELECT whatever
FROM yourtable
WHERE whatever
UNION (or UNION ALL)
SELECT "ZZ", 2,3, ...
FROM onerowtable
ORDER BY ...
 
Back
Top