2

I would collect my IIF or switch expressions in a table as a record(more over 40pcs):

tbl_filter:

Filter

Description LIKE '*SCREW*',"Screw"

Description LIKE '*SOCKET*',"SScrew"

How could I use this expression-collection in tbl_filter in a switch function in a query?

similar like this:

SELECT Item, switch(Select * from tbl_Filter) AS Cathegory FROM tbl_Materials

thanks for help in advance

Wilmer
  • 2,511
  • 1
  • 14
  • 8

1 Answers1

0

I think you mean something like the below.

tbl_Filter

Contains    Filter
Screw       Screw
Socket      Sscrew

tbl_Main

Description
Screws and sockets
Screw
Socket

Query SQL

SELECT tbl_Main.Description, tbl_Filter.Filter
FROM tbl_Main, tbl_Filter
WHERE tbl_Main.Description Like "*" & [Contains] & "*"

Result

Description         Filter
Screws and sockets  Screw
Screws and sockets  Sscrew
Screw               Screw
Socket              Sscrew
Fionnuala
  • 90,370
  • 7
  • 114
  • 152
  • Hi Fionnuala, it works fine on one field search. How could i expand it when the criteria belongs to another field too on the same record. I mean [Description] conatins a special word(as you solved in the example) and [Item] contains a 'X' charachter then the filter should be 'ScrewHighAlloy'. That's why i tought to use switch.. but i hang up on getting error.. – Tamas Ozsvath Feb 12 '15 at 10:06