Combine data from multiple tables into combo box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to create a combo box that shows data from multiple tables?
For example, Query1 pulling data from Table1 and Table2:

Table1: Customer1, Customer2, Customer3, ...
+
Table2: Vendor1, Vendor2, Vendor3, ...
=
Query1: Customer1, Customer2, Customer3, Vendor1, Vendor2, Vendor3, ...

I don't want to build an additional table each time I query the data, but I
have also considered creating an array, which might be too complicated.
Thanks for any ideas.
 
How do you want to display the data -- with one customer per row and one
vendor per row? If yes, use this query as the combo box's Row Source:

SELECT Customer As Entity From Table1
UNION ALL
SELECT Vendor From Table2;
 
Thanks Ken, it worked great. By the way, what purpose does the "as Entity"
phrase in the SQL?
 
It's an alias that is displayed as the "field name" in the query's datasheet
view, and which can be referenced as a field by another query that uses the
first query as its "table". It's not necessary, but because you are
combining customer with vendor, I wasn't sure you'd want all the data values
to be identified as Customer (which is what you'd get without the alias).
 
Back
Top