hi:
The last post we had resolve a problem with nulls and empty strings!
Now I have annother problem with Logic Operator "AND":
this is the problem:
Example:
This is the fields I have in the Database Access:
Now I want extract the fields don't have nulls or empty strings where the "Raca" be "especie" and the dt_morte1,dt_morte2,dt_morte3="Goro"Code:Raca dt_morte1 dt_morte2 dt_morte3 especie Goro Goro especie car Goro
the code:
the problem is:Code:SQL = "select Sum(IIF(dt_morte1 Is Null or dt_morte1='', 0, 1) ) as total1,Sum(IIF(dt_morte2 Is Null or dt_morte2='', 0, 1) ) as total2,Sum(IIF(dt_morte3 Is Null or dt_morte3='', 0, 1) ) as total3, from " & ano SQL = SQL & " WHERE Raca = '" & especie & "'" AND dt_morte1 = '" & Goro & "' AND dt_morte2 = '" & Goro & "' AND dt_morte3 = '" & Goro & "'
With the "AND dt_morte2 = '" & Goro & "' AND dt_morte3 = '" & Goro & "' " the code return a wrong value.He return's "0".![]()
Only with the first "AND dt_morte1 = '" & Goro &'" the code return the right value "1"![]()
Something wrong with the expression?Why the code just return the right value with one "AND"?![]()
![]()
Thanks




Reply With Quote