Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple conditionals in an Access update query 1

Status
Not open for further replies.

JaxtheDog

Programmer
Oct 3, 2002
37
US
Hello,
I am familiar with SQL and VB, but am new to Access. I need to update a column in a table based on a heirarchy of other field values in that same table. I can't find a syntax that works using a SQL query in Access. I have tried IIF, but it only gives me one true, false--and I need multiples. Once one is true, I am done and do not need to go on for that record. I am updating the entire table with this one query.

Here is what I need to do:
UPDATE tblL_Master SET tblL_Master.Primary_Media_Type =
If Paper_Location Like "LOST FILE*","LOST FILE"
elseif Film_Fiche_Flag Like "*FICHE*","FICHE"
elseif Image_Flag="FFI","FFI"
else if Paper_Location Like "*OTHER*","UNKNOWN"
else "PAPER"

I'd really appreciate it if anyone could tell me the correct syntax to use to get this done in one update statement.

Thanks!
Jax
 
UPDATE tblL_Master
SET Primary_Media_Type =
IIf(Paper_Location Like '*LOST FILE*','LOST FILE',
IIf(Film_Fiche_Flag Like '*FICHE*','FICHE',
IIf(Image_Flag='FFI','FFI',
IIf(Paper_Location Like '*OTHER*','UNKNOWN','PAPER'))))

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
It worked PERFECTLY! Thanks you so much for the quick--and correct--answer. I really appreciate it! Have a star.

Jax
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top