Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find Results From Two Different Tables

Status
Not open for further replies.

dwichmann

IS-IT--Management
Jul 15, 2005
42
GB
I have a large database with two distinct tables, one is for live orders and the other for archived orders. The first called TblOrder and the second called TblArchivedOrders. The field names in both tables are identical i.e OrderNumber, Customer, Product. I wish to write a query that will search through both tables and return any matching entries from either query. For example i would like to search for a customer called ABC Ltd and have it return any entries from TblOrders and TblArchivedOrders.

I do not know how to do this, please help
 
You could combine the tables with a union query like:
Code:
SELECT tblOrder.*, "Active" As Status
FROM tblOrder
UNION ALL
SELECT TblArchivedOrders.*, "Archive"
FROM tblArchivedOrders;
Of course this depends on the actual spelling of tblOrder(s).

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top