Query for counting

Hi Experts,
I have a query question.  I need to create a report, I have some records that haves Rejected and some records that have Returned, both are set as "Y" in the table also have the rejected date and returned date, user can select either Rejected or Returned but can't select both.  Now my question is how do I pull all the records that either Rejected or Returned?  Better I user the Date or "Y"?  Here is the field that I tried to pull the number for both but it's incorrect.

Rej/Ret: IIf(Not IsNull([PDREJDATE]),[PDREJDATE],IIf(Not IsNull([PDRETURNEDDATE]),[PDRETURNEDDATE]))

Thanks,
urjudoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
Not quite sure I follow, but:

1. I would use the date and get rid of the field with the "Y".    Both fields indicate the same thing; if something was returned or rejected.  But the date gives you more information besides the fact that something was returned or rejected.  It also gives you when it was.

2. You check I believe should be:

Rej/Ret: IIf(Not IsNull([PDREJDATE]  or Not IsNull([PDRETURNEDDATE], True, False)

Jim.
0
etech0Commented:
Why don't you use design view, and put criteria in for the fields. Then you won't need to use iif.
0
urjudoAuthor Commented:
I tried JDettman's suggestion, but gave me error message.  I'm using the design view to do this query.
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

etech0Commented:
In the criteria section under the RejectedDate field, put "Is Not Null"
Then in the next row of criteria, under the ReturnedDate field, put "Is Not Null"
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jeffrey CoachmanMIS LiasonCommented:
<No points wanted,
try Jims SQL like this:

Rej/Ret: IIf(Not IsNull([PDREJDATE])  or Not IsNull([PDRETURNEDDATE]), True, False)

If it still errors then please post the exact error message...
0
urjudoAuthor Commented:
thanks, this way works.
0
etech0Commented:
Glad to help!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.