combining 2 expressions

C

clalc

I have created 2 separate expressions in query:
Test_1: IIf(
![Field2] Not Like ("*[A-Z0-9]*"),"Missing",0)

Test_2: IIf(
![Field1] Not Like ("*[A-Z0-9]*"),1, "Found")

When I combine them into:
Test_3: IIf(
![Field1] Not Like ("*[A-Z0-9]*"),1,IIf(
![Field2]
Not Like ("*[A-Z0-9]*"),"Missing",0))
I get the #Error message where Field2 is missing. Why is that so ?
 
J

Jeff Boyce

"Missing" is such an overrated term...

If you look at a field and see nothing, you assume it is "missing".

If Access looks at a field, it can see a Null (nothing there), or a
zero-length string (zls - ""), or one/more blanks/spaces.

Maybe you need to tell Access a bit more specifically what to look for?

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
M

Marshall Barton

clalc said:
I have created 2 separate expressions in query:
Test_1: IIf(
![Field2] Not Like ("*[A-Z0-9]*"),"Missing",0)

Test_2: IIf(
![Field1] Not Like ("*[A-Z0-9]*"),1, "Found")

When I combine them into:
Test_3: IIf(
![Field1] Not Like ("*[A-Z0-9]*"),1,IIf(
![Field2]
Not Like ("*[A-Z0-9]*"),"Missing",0))
I get the #Error message where Field2 is missing. Why is that so ?



Can't be sure, but you are probably confusing Access about
what type the field should be. Since you need text some of
the time, you really need to make it text all the time by
enclosing the 1 and 0 in quotes.
 
C

clalc

You are right Marsh I have used 0 and 1 for words and it worked.
thank you !

Marshall Barton said:
clalc said:
I have created 2 separate expressions in query:
Test_1: IIf(
![Field2] Not Like ("*[A-Z0-9]*"),"Missing",0)

Test_2: IIf(
![Field1] Not Like ("*[A-Z0-9]*"),1, "Found")

When I combine them into:
Test_3: IIf(
![Field1] Not Like ("*[A-Z0-9]*"),1,IIf(
![Field2]
Not Like ("*[A-Z0-9]*"),"Missing",0))
I get the #Error message where Field2 is missing. Why is that so ?



Can't be sure, but you are probably confusing Access about
what type the field should be. Since you need text some of
the time, you really need to make it text all the time by
enclosing the 1 and 0 in quotes.
 

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