IIF x=y, >4<8,100

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to do an iif statement in a query criteria. IIF x=y, >4 and <8,
100. It wont bring any data back with this statement in....if I replace the
 
I am trying to do an iif statement in a query criteria. IIF x=y, >4 and <8,
100. It wont bring any data back with this statement in....if I replace the

I'm GUESSING that what you want is:

If x = y then the field being searched should be between 4 and 8
If x is not equal to y, then the field being searched should be 100

The problem is that you cannot pass *operators* - greater or less than
signs, AND - as parameters; the only thing you can generate as a
parameter from an IIF is the actual value to be searched. Try going
into SQL view and changing the WHERE clause to

WHERE ([X]=[Y] AND [field] > 4 AND [field] < 8) OR ([X] <> [Y])


John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
Back
Top