IIF QUERY

Z

zyus

In my query i hv the following field & data

[F1] [F2] [F3] [F4] NewField
A - A - A
- A - - A
- - - - -
A A A A A

Based on the above, i try to put newfield="A" whenever there are "A" in
F1,F2,F3 & F4.

Thanks
 
J

John W. Vinson

In my query i hv the following field & data

[F1] [F2] [F3] [F4] NewField
A - A - A
- A - - A
- - - - -
A A A A A

Based on the above, i try to put newfield="A" whenever there are "A" in
F1,F2,F3 & F4.

Thanks

I hope these are fields derived from the query, not stored in your table; it
would be badly non-normalized if it were!

That said: What if there's a B in one field? What if there's an A in one field
and a B in another? Are A and Null the only values you'll ever encounter?

If so, then:

NewField: IIf([F1] = "A" OR [F2] = "A" OR [F3] = "A" OR [F4] = "A", "A", Null)

but it's a lousy way to run a railroad!
 
Z

zyus

Thanks for your reply John,

All fields are derived from the query . The info is either A or -. Will try
your suggestion. Though it's lousy way but definitely it's provide me some
light to my access darkness world..

John W. Vinson said:
In my query i hv the following field & data

[F1] [F2] [F3] [F4] NewField
A - A - A
- A - - A
- - - - -
A A A A A

Based on the above, i try to put newfield="A" whenever there are "A" in
F1,F2,F3 & F4.

Thanks

I hope these are fields derived from the query, not stored in your table; it
would be badly non-normalized if it were!

That said: What if there's a B in one field? What if there's an A in one field
and a B in another? Are A and Null the only values you'll ever encounter?

If so, then:

NewField: IIf([F1] = "A" OR [F2] = "A" OR [F3] = "A" OR [F4] = "A", "A", Null)

but it's a lousy way to run a railroad!
 

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