By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,647 Members | 1,444 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,647 IT Pros & Developers. It's quick & easy.

OpenReport (WhereClause) problem

P: 16
Good day,

I have the following string that i put as the whereclause (pass as a string value) in order to create a report:
Expand|Select|Wrap|Line Numbers
  1. "DATE_POD_COMPLETED is not null and (((Year(DATE_POD_COMPLETED) = '2009' and Month(DATE_POD_COMPLETED) >= '4') AND (Year(DATE_POD_COMPLETED)= '2010' and Month(DATE_POD_COMPLETED) <= '3')))"
That does not work, but when i use each part individually as the whereclause, i'm able to generate the report :
Expand|Select|Wrap|Line Numbers
  1. "DATE_POD_COMPLETED is not null and (((Year(DATE_POD_COMPLETED) = '2009' and Month(DATE_POD_COMPLETED) >= '4')))"
Expand|Select|Wrap|Line Numbers
  1. "DATE_POD_COMPLETED is not null and(((Year(DATE_POD_COMPLETED)= '2010' and Month(DATE_POD_COMPLETED) <= '3')))"
Someone as an idea of what is wrong ?

Thanks.
Apr 9 '10 #1

✓ answered by atoy

That was a logical error
Expand|Select|Wrap|Line Numbers
  1. "DATE_POD_COMPLETED is not null and (((Year(DATE_POD_COMPLETED) = '2009' and Month(DATE_POD_COMPLETED) >= '4') AND (Year(DATE_POD_COMPLETED)= '2010' and Month(DATE_POD_COMPLETED) <= '3')))"
the AND in bold was replace by OR and it worked.


Thanks

Share this Question
Share on Google+
5 Replies


P: 16
That was a logical error
Expand|Select|Wrap|Line Numbers
  1. "DATE_POD_COMPLETED is not null and (((Year(DATE_POD_COMPLETED) = '2009' and Month(DATE_POD_COMPLETED) >= '4') AND (Year(DATE_POD_COMPLETED)= '2010' and Month(DATE_POD_COMPLETED) <= '3')))"
the AND in bold was replace by OR and it worked.


Thanks
Apr 9 '10 #2

NeoPa
Expert Mod 15k+
P: 31,261
@atoy
Absolutely. You are using AND when you mean OR. It is not possible to have a record match the criteria that says it must be '2009' AND '2010'.
Apr 9 '10 #3

P: 16
Thanks NeoPa to confirm my conclusion.
Apr 9 '10 #4

NeoPa
Expert Mod 15k+
P: 31,261
Actually, your conclusion wasn't showing when I opened the thread. I opened it and left it a while as I had other things to squeeze in. It does confirm your understanding though :)
Apr 12 '10 #5

P: 16
Thanks anyway Neopa.
Apr 12 '10 #6

Post your reply

Sign in to post your reply or Sign up for a free account.