Having fun with 'and or' in an iff statement

J

jon

Hi
I am trying to get a field in a query to return a 1 or 0 depending on 3
fields

the field 'pass' must = 1
the field 'CMMReInspect' must not be = -1
the field 'CMMReInspectCleanHoles' must not be =-1
I have the line I am using at the moment but it retunes incorrect as when a
record is = 1 and one of the other fields is -1 it still makes it as a 1.(if
that makes sense).

The line is:-

Pass1st: IIf([Pass]=1 And [CMMReInspect]=0 Or [Pass]=1 And
[CMMReInspectCleanHoles]=0,1,0)


Thanks

Jon
 
D

Douglas J. Steele

I don't understand why you have the Or in there at all.

Pass1st: IIf([Pass]=1 And [CMMReInspect]=0 And
[CMMReInspectCleanHoles]=0,1,0)
 
J

jon

Thanks Doug
Sorted
I don't know why I put the 'and' in, I was doing it in 2 stages, instead of
doing simple.

Ta Jon

Douglas J. Steele said:
I don't understand why you have the Or in there at all.

Pass1st: IIf([Pass]=1 And [CMMReInspect]=0 And
[CMMReInspectCleanHoles]=0,1,0)


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


jon said:
Hi
I am trying to get a field in a query to return a 1 or 0 depending on 3
fields

the field 'pass' must = 1
the field 'CMMReInspect' must not be = -1
the field 'CMMReInspectCleanHoles' must not be =-1
I have the line I am using at the moment but it retunes incorrect as when
a record is = 1 and one of the other fields is -1 it still makes it as a
1.(if that makes sense).

The line is:-

Pass1st: IIf([Pass]=1 And [CMMReInspect]=0 Or [Pass]=1 And
[CMMReInspectCleanHoles]=0,1,0)


Thanks

Jon
 

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