Combine data from multiple tables into combo box

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.
 
K

Ken Snell \(MVP\)

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;
 
G

Guest

Thanks Ken, it worked great. By the way, what purpose does the "as Entity"
phrase in the SQL?
 
K

Ken Snell \(MVP\)

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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top