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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

qGOLOM, part 2 - Cannot save

Status
Not open for further replies.

Kurt6905

Technical User
Aug 21, 2006
14
0
0
US
Hi,

I adapted what a few of you wrote as follows. However, Access won't let me save it - says there's a syntax error in the From clause. How can I correct it?

Thanks.


Select License, County, EPA_Reg, Brandname, Chem, Active, Pestcode

From
(
Select License, County, EPA_Reg, Brandname, Chem1 As Chem, Active1 As Active, Pestcode
From myTable
Where Active1 > 0

Union All

Select License, County, EPA_Reg, Brandname, Chem2, Active2, Pestcode
From myTable
Where Active2 > 0

Union All

Select License, County, EPA_Reg, Brandname, Chem3, Active3, Pestcode
From myTable
Where Active3 > 0

Union All

Select License, County, EPA_Reg, Brandname, Chem4, Active4, Pestcode
From myTable
Where Active4 > 0
)
 
Access is probably "helping" you out by reformatting the SQL. Save this as (for example) [blue]qryUNION[/blue]
Code:
Select License, County, EPA_Reg, Brandname, Chem1 As Chem, Active1 As Active, Pestcode
From myTable
Where Active1 > 0

Union All

Select License, County, EPA_Reg, Brandname, Chem2, Active2, Pestcode
From myTable
Where Active2 > 0

Union All

Select License, County, EPA_Reg, Brandname, Chem3, Active3, Pestcode
From myTable
Where Active3 > 0

Union All

Select License, County, EPA_Reg, Brandname, Chem4, Active4, Pestcode
From myTable
Where Active4 > 0

And then
Code:
Select License, County, EPA_Reg, Brandname, Chem, Active, Pestcode

From qryUNION
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top