Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Odd Numbers

Status
Not open for further replies.

iwanalearn

Technical User
Sep 21, 2001
22
US
In Microsoft Access 2000, I want to query a number field and have the query only pull out the odd numbers. I've found in a different thread showing how it is done for even numbers and it works great. See Below. I'm new to Access and can't figure out how to apply this to odd numbers.
Thanks

JerryDennison (IS/IT--Manageme) Apr 3, 2001
Yes, add a field to the QBE grid using the following syntax(substitute your actual field names where I have place holders):

Even: [FieldName] Mod 2

Then, in this field's criteria put False. The remainder of any even number when divided by 2 is 0. Since 0 is always False(another way to look at it, is any number that is NOT 0 is True) then setting the criteria to False will give you only those records that are even.


 
Hi!

Instead of setting the criteria to equal False, set it to equal True.

hth
Jeff Bridgham
 

You can use [FieldName] Mod 2 = True
Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Wow! It works great.
Seems like a dumb question now.
Thanks for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top