View Full Version : select odd or even records


manu
08-28-2001, 02:51 PM
Can someone guide me in writing a query so I can select either all Odd (1,3,5,7..) or even(2,4,6,8...) records from my table. I have a Sr# field with "Autonumber" format.

All help is appreciated.

Manu

rich.barry
08-28-2001, 10:34 PM
Setting a criteria for the AutoNumberField

[Table1]![AutoNumberField]/2=int([Table1]![AutoNumberField]/2)

will select all those exactly divisible by 2 i.e. evens

<> rather than = will select non evens

Alexandre
08-29-2001, 04:07 AM
Also with the MOD function:

If [Table1]![AutoNumberField] MOD 2 = 1 then 'the Autonumber is odd...

Alex