help with nested iif statement

  • Thread starter Help with complex nested iif statement
  • Start date
H

Help with complex nested iif statement

I have a table and I want to create a query that has a new field "
Type of Shipment" base on a field "Item Category"

If the item category field equals ZDIR, ZTRN ...etc up to 23 different item
categories the "Type of Shipment field will equal DIRECT else I would like it
to return "Stock"
Any help will be greatly appreciated.

Thanks
 
J

John W. Vinson

I have a table and I want to create a query that has a new field "
Type of Shipment" base on a field "Item Category"

If the item category field equals ZDIR, ZTRN ...etc up to 23 different item
categories the "Type of Shipment field will equal DIRECT else I would like it
to return "Stock"
Any help will be greatly appreciated.

Thanks

If the relationship between the category and the output is ever likely to
change, then I'd really suggest adding another field to the Item Categories
table containing "DIRECT" or "STOCK", and just use that field. Someday you
might want to add other values ("DISCARD", "INDIRECT", ...???), and you'll
surely want to be able to add or change categories without having to dig
through a nasty complicated IIF statement.

That said... try

TypeOfShipment: IIF([Category] IN ("ZDIR", "ZTRN", "..."), "DIRECT", "STOCK")
 

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


Top