Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Select only even or odd number records

564 views
Skip to first unread message

Phillip

unread,
Mar 28, 2010, 9:45:01 PM3/28/10
to
Hi,
I have a table with among other things has on number field. I want two
reports, one that select only records with even number in the number field
and the second report that selects only records with odd numbers in the
number field.
I'm on the query builder screen and can't figure out the correct code to
place in the criteria section for each report.
Your help would be appreciated.
Thanks in advance.

Duane Hookom

unread,
Mar 28, 2010, 10:14:56 PM3/28/10
to
You can take you unnamed number field and use /2 or the Mod operator to
create a column in the query/record source:
OddEven: [UnnamedNumericField] Mod 2

In the criteria, enter 1 for odd records or 2 for even.

--
Duane Hookom
MS Access MVP


"Phillip" <Phi...@discussions.microsoft.com> wrote in message
news:ED23477D-F91C-4D1D...@microsoft.com...

Phillip

unread,
Mar 28, 2010, 11:37:01 PM3/28/10
to
Hi Duane,
Thanks for your response, but I'm not sure how to do what you said. I can't
place an expression in the criteria section of my number field in the query
builder screen?
Thanks,
Phil

Duane Hookom

unread,
Mar 28, 2010, 11:59:54 PM3/28/10
to
Did you try create the OddEven field in your query and then look at the
results in datasheet view? You should see 0s and 1s. There are lots of
solutions for filtering a report based on a field value in the query.

--
Duane Hookom
MS Access MVP


"Phillip" <Phi...@discussions.microsoft.com> wrote in message

news:B430C91A-3289-4228...@microsoft.com...

0 new messages