query error

G

Guest

hi,

I ahve the following:

SELECT DISTINCT tbl_resolved.resolvedStatus,
Count(tbl_resolved.resolvedStatus) AS CountOfstatus,
IIf(Forms!frm_criteria!status1 Is Null,"",[New Institution Name]) AS test,
IIf(Forms!frm_criteria!status2 Is Null,"",[Division Name]) AS
division_name_value FROM tbl_resolved WHERE tbl_resolved.[resolvedstatus] IN
('BK','CHARGEOFF','CURRENT_AMD/DFR','CURRENT_BKAMD/DFR','CURRENT_PAID','PAIDOFF','REPO',)
AND IIf(Forms!frm_criteria!status1 Is Null,"",[New Institution Name]) AS test
IN ('Arcadia','AutoOne','TranSouth',) AND IIf(Forms!frm_criteria!status2 Is
Null,"",[Division Name]) AS [division_name_value] IN
('Central','Closed','CTNA',) GROUP BY tbl_resolved.resolvedStatus ORDER BY
tbl_resolved.resolvedStatus;

but I am getting an error message that says:
syntax error (missing operator)...

can anyone tell what is wrong upon just looking at this?

thanks in advance,
geebee
 
G

Guest

The Is Null statement works in SQL for example:
Where [SomeField] Is Null
In the IIf statement, it does not. The IIf is a VBA function, so you have
to use VBA syntax:

I fixed the first one as an example:
IIf(IsNull(Forms!frm_criteria!status1)l,"",[New Institution Name])
 
D

Douglas J. Steele

In addition to Klatuu's suggestion, you seem to have extra commas at the end
of your IN lists.
 

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

Similar Threads

query error 3
change to UPDATE query 3
runtime error 1
query error 3
complex query error 1
Query Error 2
combine 2 access queries 3
runtime error 3001 invalid argument error message 2

Top