RESERVED WORD or AGRUMENT NAME

N

nazzoli

I am receiving this error quite a bit when trying to run one of my queries.

Here is my SQL. Please help

SELECT Union.[ACCT#], Union.DateValue, IIf([DATEVALUE]=[600 DISM DTE],[600
DISM DTE],IIf([DATEVALUE]=[801 DISCH/DISM DTE],[801
DESC],IIf([DATEVALUE]=[605 STATUS DTE1],[605 DISP1],IIf([DATEVALUE]=[605
STATUS DTE2],[605 DISP2],IIf([DATEVALUE]=[605 STATUS DTE3],[605 DISP3])))))
AS STATUS, IIf([DATEVALUE]=[605 STATUS DTE1],[605 TYPE1],IIf([DATEVALUE]=[605
STATUS DTE2],[605 TYPE2],IIf([DATEVALUE]=[605 STATUS DTE3],[605
TYPE3],IIf([DATEVALUE]=[600 DISM DTE],[600 TYPE],IIf([DATEVALUE]=[801
DISCH/DISM DTE],[801 TYPE]))))) AS TYPE, Format([DATEVALUE],"mmmm") AS
[MONTH], Format([DATEVALUE],"yyyy") AS [YEAR], [BKDIS2#].CLIENT,
[BKDIS2#].[PURCH BAL], IIf([TYPE]="13 - DEBT
REORGANIZATION","13",IIf([TYPE]="7","7",IIf([TYPE]="7 -
Liquidation","7",IIf([TYPE]="13","13",IIf([TYPE]="11 - BUSINESS
BANKRUPTCY","11",IIf([TYPE]="12","12",IIf([TYPE]="8","8",IIf([TYPE]="9","9",IIf([type]="11","11",IIf([type]="12
- Farm Bankruptcy","12",IIf([type]="10","10"))))))))))) AS MainType FROM
[Union] LEFT JOIN [BKDIS2#] ON UNION .[ACCT#]=[BKDIS2#].[ACCT#];
 
K

KARL DEWEY

Union is a reserved word. You might get away with using it IF you put it in
brackets all the time, which you did not.
Also unless you made a typo in posting you have a space between UNION and
period in the last line.

NEXT - DateValue is a function you used as a field. Same thing, maybe if in
brackets.
You have IIf([DATEVALUE]=[600 DISM DTE],[600 DISM DTE], which leads me to
believe that DATEVALUE is a text field but then you have
Format([DATEVALUE],"mmmm") AS [MONTH] which appears to be a date.
 
G

GeoffG

Looks like you've named a table "Union", which is a reserved word.
If that's the case, rename the table.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top