Union Query 'Select Statement contains reserved word...' Error - Microsoft Community


hi,

i have tried implement union query combine 2 select queries. queries work individually when try combine them following error:

'the select statement contains reserved word or argument misspelled or missing, or punctuation incorrect'

one of queries checks tasks completed today, , second searches archive table tasks not completed when should have been (with few clauses ensure same task not appear twice). i'm new sql , have been looking @ should have use sql code both queries union statement in between, such copy , pasted sql each query. since have no real idea of sql can't find problem appreciated.

here sql code:

select [test maintenance log].[date performed], [test maintenance log].components, [test maintenance log].[task description], [test maintenance log].notes, [test maintenance log].[complete?], [test maintenance log].[inspector name], [test maintenance log].[task id],
[test maintenance log]
((([test maintenance log].frequency)=1)) or ((([test maintenance log].frequency)=7) , ((fullweeks())=true)) or ((([test maintenance log].frequency)=14) , ((fullbiweeks())=true));
union
select archive.[date performed], archive.components, archive.[task description], archive.notes, archive.[complete?], archive.[inspector name], archive.[task id]
archive
(((archive.[complete?])=false) , (not (archive.frequency)=1)) or (((archive.[complete?])=false) , ((archive.frequency)=7) , ((fullweeks())=false)) or (((archive.[complete?])=false) , ((archive.frequency)=14) , ((fullbiweeks())=false));

i don't see problem immediately. list of reserved words here: https://support.office.com/en-us/article/access-2007-reserved-words-and-symbols-e33eb3a9-8baa-4335-9f57-da237c63eabe

one thing copy each individual clause in new query in sql view, , switch design view. sql parser point out problem.

btw, why not using union all?



Office / Access / Other/unknown / Unknown/other



Comments

Popular posts from this blog

Getting ErrorCode: 120018 when trying to access Microsoft account - Microsoft Community

The message was sent to a distribution list ‎(DL)‎ - Microsoft Community

Activation Error 0x8004FE93 - Microsoft Community