Union Query Syntax Error

D

Dustin Ventin

I want to link several queries together and have them display thier data all
at once for export. Each individual query works just fine, although they do
each require that a piece of data in their WHERE clauses come from a form
that will be open. The query is as follows:

SELECT * FROM qryExportEstimate2Primavera

UNION

SELECT * FROM qryPrimaveraFISI

UNION

SELECT * FROM qryPrimaveraMaterialCost

UNION SELECT * FROM qryPrimaveraOH&P;

However, whenever I try to run it, I get the error: "Syntax Error in FROM
clause."

What's the problem?

Thanks!

Dustin
 
D

Douglas J. Steele

Assuming both queries have matching fields (same number of fields, each
corresponding field is the same type), I'd actually expect the special
character in qryPrimaveraOH&P to cause problems. See whether enclosing the
name in square brackets ([qryPrimaveraOH&P]) helps.
 
D

Dustin Ventin

Thanks! That was it!

Dustin


Douglas J. Steele said:
Assuming both queries have matching fields (same number of fields, each
corresponding field is the same type), I'd actually expect the special
character in qryPrimaveraOH&P to cause problems. See whether enclosing the
name in square brackets ([qryPrimaveraOH&P]) helps.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Dustin Ventin said:
I want to link several queries together and have them display thier data
all
at once for export. Each individual query works just fine, although they
do
each require that a piece of data in their WHERE clauses come from a form
that will be open. The query is as follows:

SELECT * FROM qryExportEstimate2Primavera

UNION

SELECT * FROM qryPrimaveraFISI

UNION

SELECT * FROM qryPrimaveraMaterialCost

UNION SELECT * FROM qryPrimaveraOH&P;

However, whenever I try to run it, I get the error: "Syntax Error in FROM
clause."

What's the problem?

Thanks!

Dustin
 
Top