SQL With a IIF and a LIKE

Z

ZigZagZak

I have a combo box that I based on a query. Access is saying the query is to
complex. I am obviously not doing it right.....help???

SELECT MATERIAL.SIZE
FROM MATERIAL
WHERE (((MATERIAL.[MATERIAL TYPE])=IIf([Forms]![SUGGEST DROPS]![MATERIAL]
Like "*" & "BAR" & "*",([MATERIAL].[MATERIAL TYPE])<>"304SS PLATE" And
([MATERIAL].[MATERIAL TYPE])<>"1040MOD" And ([MATERIAL].[MATERIAL
TYPE])<>"A36",([MATERIAL].[MATERIAL TYPE])<>"304SS BAR" And
([MATERIAL].[MATERIAL TYPE])<>"303SS BAR" And ([MATERIAL].[MATERIAL
TYPE])<>"RED BAR" And ([MATERIAL].[MATERIAL TYPE])<>"BLACK BAR" And
([MATERIAL].[MATERIAL TYPE])<>"YELLOW BAR")))
ORDER BY MATERIAL.SIZEDEC;
 
Z

ZigZagZak

nevermind.........figured it out..............sometimes its because you make
it harder than it was supposed to be.......arg......
 
R

Rob Wills

Hi,

Try replacing all those ANDs with an in statement.....

[Material Type] not in("304SS PLAtE", "1040MOD","A36","304SS BAR")

Etc....

HTH
Rob
 

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