iif is null statement with qualifiers

M

michelle11_5

Hi,

Using access queries only..
I have two fields, if the first field is null, then it should refer to the
second for specific words, and fill in the first field with a keyword, if the
field is not null, then leave alone. I'm getting error "The expression you
entered contains invalid syntax"


ERROR_CODE: IIf([error_code] Is Null and IIf ([error_event]like'*Manual
collection*','Manual')[error_code], (iif ([error_code] Is Null and
IIf([error_event]) like "*UTC 1970", "Never"), [error_code]))

Help? Thanks!
 
K

KARL DEWEY

Your IIF statement does not match your verbage but here is a guess --
ERROR_CODE: IIf([error_code] Is Null And (([error_event] like "*Manual*") Or
([error_event] like "*UTC 1970")), "Never", [error_code])
 
M

michelle11_5

Thanks for the quick reply! :)

Actually, if it is null and says anything manual* it needs to return Manual
and if it is null and says anything *UTC 1970 then return Never, but if it
already has a code entered, leave the code as is.

KARL DEWEY said:
Your IIF statement does not match your verbage but here is a guess --
ERROR_CODE: IIf([error_code] Is Null And (([error_event] like "*Manual*") Or
([error_event] like "*UTC 1970")), "Never", [error_code])


michelle11_5 said:
Hi,

Using access queries only..
I have two fields, if the first field is null, then it should refer to the
second for specific words, and fill in the first field with a keyword, if the
field is not null, then leave alone. I'm getting error "The expression you
entered contains invalid syntax"


ERROR_CODE: IIf([error_code] Is Null and IIf ([error_event]like'*Manual
collection*','Manual')[error_code], (iif ([error_code] Is Null and
IIf([error_event]) like "*UTC 1970", "Never"), [error_code]))

Help? Thanks!
 
K

KARL DEWEY

Try this --
ERROR_CODE: IIf([error_code] Is Null And [error_event] like "*Manual*",
"Manual", IIF([error_code] Is Null And [error_event] like "*UTC 1970",
"Never", [error_code]))


michelle11_5 said:
Thanks for the quick reply! :)

Actually, if it is null and says anything manual* it needs to return Manual
and if it is null and says anything *UTC 1970 then return Never, but if it
already has a code entered, leave the code as is.

KARL DEWEY said:
Your IIF statement does not match your verbage but here is a guess --
ERROR_CODE: IIf([error_code] Is Null And (([error_event] like "*Manual*") Or
([error_event] like "*UTC 1970")), "Never", [error_code])


michelle11_5 said:
Hi,

Using access queries only..
I have two fields, if the first field is null, then it should refer to the
second for specific words, and fill in the first field with a keyword, if the
field is not null, then leave alone. I'm getting error "The expression you
entered contains invalid syntax"


ERROR_CODE: IIf([error_code] Is Null and IIf ([error_event]like'*Manual
collection*','Manual')[error_code], (iif ([error_code] Is Null and
IIf([error_event]) like "*UTC 1970", "Never"), [error_code]))

Help? Thanks!
 
M

michelle11_5

Like a charm... Thank you!

KARL DEWEY said:
Try this --
ERROR_CODE: IIf([error_code] Is Null And [error_event] like "*Manual*",
"Manual", IIF([error_code] Is Null And [error_event] like "*UTC 1970",
"Never", [error_code]))


michelle11_5 said:
Thanks for the quick reply! :)

Actually, if it is null and says anything manual* it needs to return Manual
and if it is null and says anything *UTC 1970 then return Never, but if it
already has a code entered, leave the code as is.

KARL DEWEY said:
Your IIF statement does not match your verbage but here is a guess --
ERROR_CODE: IIf([error_code] Is Null And (([error_event] like "*Manual*") Or
([error_event] like "*UTC 1970")), "Never", [error_code])


:

Hi,

Using access queries only..
I have two fields, if the first field is null, then it should refer to the
second for specific words, and fill in the first field with a keyword, if the
field is not null, then leave alone. I'm getting error "The expression you
entered contains invalid syntax"


ERROR_CODE: IIf([error_code] Is Null and IIf ([error_event]like'*Manual
collection*','Manual')[error_code], (iif ([error_code] Is Null and
IIf([error_event]) like "*UTC 1970", "Never"), [error_code]))

Help? Thanks!
 

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