Hi!! I'm getting crazy here... I'm trying to put a limit to the values... This first SQL works great... But when I try to link the HAVING condition to a Form it show all the records!! WHY?
What is [Formulários] is my Portuguese Access for Forms.
And YES... this object exists!
Does anyone have a clue??????
SQL1: Works great!
SELECT DISTINCTROW CPF.Nome, CPF.CPF, Sum([valor])-Sum([valor pago]) AS Dev, Count(CPF.CPF) AS ContarDeCPF
FROM CPF INNER JOIN Cheques ON CPF.CPF = Cheques.CPF
GROUP BY CPF.Nome, CPF.CPF
HAVING (((Sum([valor])-Sum([valor pago]))>2000))
ORDER BY Sum([valor])-Sum([valor pago]) DESC;
SQL2: Doesn't work!
SELECT DISTINCTROW CPF.Nome, CPF.CPF, Sum([valor])-Sum([valor pago]) AS Dev, Count(CPF.CPF) AS ContarDeCPF
FROM CPF INNER JOIN Cheques ON CPF.CPF = Cheques.CPF
GROUP BY CPF.Nome, CPF.CPF
HAVING (((Sum([valor])-Sum([valor pago]))>[Formulários]![Formulário1]![Texto0]))
ORDER BY Sum([valor])-Sum([valor pago]) DESC;
What is [Formulários] is my Portuguese Access for Forms.
And YES... this object exists!
Does anyone have a clue??????
SQL1: Works great!
SELECT DISTINCTROW CPF.Nome, CPF.CPF, Sum([valor])-Sum([valor pago]) AS Dev, Count(CPF.CPF) AS ContarDeCPF
FROM CPF INNER JOIN Cheques ON CPF.CPF = Cheques.CPF
GROUP BY CPF.Nome, CPF.CPF
HAVING (((Sum([valor])-Sum([valor pago]))>2000))
ORDER BY Sum([valor])-Sum([valor pago]) DESC;
SQL2: Doesn't work!
SELECT DISTINCTROW CPF.Nome, CPF.CPF, Sum([valor])-Sum([valor pago]) AS Dev, Count(CPF.CPF) AS ContarDeCPF
FROM CPF INNER JOIN Cheques ON CPF.CPF = Cheques.CPF
GROUP BY CPF.Nome, CPF.CPF
HAVING (((Sum([valor])-Sum([valor pago]))>[Formulários]![Formulário1]![Texto0]))
ORDER BY Sum([valor])-Sum([valor pago]) DESC;