Access2003 query using IIF in calculated field returns negative

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

Guest

I use this function - Age1920:IIf([Age]>18,1,0) And IIf([Age]<21,1,0) in a
calculated field. It works fine except it returns a -1 for a value of say 19
above in Age. How can I make it return positive number
 
-1 is the integer value for True under VBA. The result of the AND is true,
hence the result of -1.

Try something like:
Iif (([Age]>18 and [Age] < 21),1,0)

or:
IIf([Age]>18, iif ([Age] < 21, 1,0), 0)

S. L.
 

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

Back
Top