Query Design Grid IIf Function

G

Guest

This does what I want it to do, but it's so long, and I know there must be a
shorter/easier way of writing it.

Any help is very much appreciated!

DxCode: IIf([Dx1Code] Like "V72.3*","V72.3*",IIf([Dx2Code] Like
"V72.3*","V72.3*",IIf([Dx3Code] Like "V72.3*","V72.3*",IIf([Dx4Code] Like
"V72.3*","V72.3*",IIf([Dx1Code] Like "V25*","V25*",IIf([Dx2Code] Like
"V25*","V25*",IIf([Dx3Code] Like "V25*","V25*",IIf([Dx4Code] Like
"V25*","V25*"))))))))
 
J

John Spencer

Not much shorter, but perhaps a little clearer

IIF(Dx1Code Like "V72.3*" OR Dx2Code Like "V72.3*" or Dx3Code Like "V72.3*"
Or Dx4Code Like "V72.3*", "V72.3*",
IIF(Dx1Code Like "V25*" OR Dx2Code Like "V25*" or Dx3Code Like "V25*" Or
Dx4Code Like "V25*", "V25*",Null))

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 

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