0

I have a problem with my expression in a Calculated field in an access [2007] table. I need to find out if a number is odd or even but I can't get the Modulo function to work.

This doesn't work: IIf( [No] Mod 2 = 0, [No] - 1, [No] + 1)

[ Just to check - the following expression works (eventhough nonsense): IIf( [No] > 2, [No] - 1, [No] + 1) ]

Any ideas?

Stealth
  • 25
  • 4

1 Answers1

0

It works in queries, but not in calculated fields. Strange.
You can solve it like this instead:

IIf([Field1]/2=Round([Field1]/2), [Field1]-1, [Field1]+1)

Not Mod, but the same result

Sam
  • 5,424
  • 1
  • 18
  • 33