Joining Results of 2 Queries

E

Ed Shanley

I have a database where the end-user can put in a number of different sort
codes for each client (i.e. BE01, BE02, BE03). Each client can have multiple
sort codes. The end-user would like the ability to enter 30 different sort
codes and have mailing labels print out. I've set up the query to pull the
records from a form where they can enter the Sort Codes they want.

The problem comes in that when i set up the query and define the Sort Code
Definitition in the query, i can only enter the 1st 18 fields from the form
before i pass the 1028 mark. So I set up 2 queries to do this function, one
for codes 1-15 and one for codes 16-30. The question that I have is this,
how do I combine those 2 queries, to do one set of labels.

Btw - i am planning on removing duplicates, but I already know how to do
that.

I would greatly appreciate any assistance.

Ed.
 
S

Simon

Sounds like you might be able to use a Union query.

Select * from Query1
Union
Select * from Query2

This will automatically eliminate duplicates too.

HTH
 
M

[MVP] S.Clark

You can try a Union query, or write both results to another table(Append
Query).
The latter is probably better considering the need to dedup.
 
J

John Spencer (MVP)

Can you use an or clause to allow you to put 1-15 in one comparison and the
second ones in a second comparison?

WHERE SomeField In ("BE01","BE02",...) OR SomeField In ("BE16","Be17",...)

OR can you build a temporary table with the specified values and do a join
between the temp tables contents and the sort codes in the main table?
 
Top