?
=?ISO-8859-1?Q?Mathieu_Pag=E9?=
Hi,
In Access 2003, I have a query that return a "Division by Zero" error
while it should not :
<code>
SELECT reqNbMotsAffectesParDetailParService.CodeDetail,
reqNbMotsAffectesParDetailParService.SommeDeNbMots,
reqNbMotsParDetailParService.Quantite,
IIf([SommeDeNbMots]>[Quantite],([SommeDeNbMots]-[Quantite])/[Quantite],([Quantite]-[SommeDeNbMots])/[SommeDeNbMots])
AS Expr2
FROM reqNbMotsAffectesParDetailParService INNER JOIN
reqNbMotsParDetailParService ON
(reqNbMotsAffectesParDetailParService.CodeService =
reqNbMotsParDetailParService.CodeService) AND
(reqNbMotsAffectesParDetailParService.CodeDetail =
reqNbMotsParDetailParService.CodeDetail)
WHERE
(((IIf([SommeDeNbMots]>[Quantite],([SommeDeNbMots]-[Quantite])/[Quantite],([Quantite]-[SommeDeNbMots])/[SommeDeNbMots]))>0));
</code>
It's a bit complex if you don't know what it supposed to do, so I'll
explain what it do. It takes the data from two queries, join them
together and compute a result (Expr2) based on some data coming from
both tables.
The computation involve an IIF with some division :
<code>
IIf([SommeDeNbMots]>[Quantite],([SommeDeNbMots]-[Quantite])/[Quantite],([Quantite]-[SommeDeNbMots])/[SommeDeNbMots])
</code>
I already know that no mater what the condition evaluates to, both parts
of the IIF get evaluated. However, in the originals queries, "Quantite"
and "SommeDeNbMots" are never equal to zero, so there should be no problem.
Furthermore if I remove the WHERE clause, the query return a result
without any error.
Even more odds : If I change the condition in the where clause for ">1"
I get the division by zero error then the query stay in design mode, if
I change the condition for "<1" (Note the lesser than) I get the same
error, but the query is now in view mode with "#name" written in every
fields of the only visible row (Same behavior than with ">0").
Can someone help me with this problem?
Mathieu Pagé
(e-mail address removed)
In Access 2003, I have a query that return a "Division by Zero" error
while it should not :
<code>
SELECT reqNbMotsAffectesParDetailParService.CodeDetail,
reqNbMotsAffectesParDetailParService.SommeDeNbMots,
reqNbMotsParDetailParService.Quantite,
IIf([SommeDeNbMots]>[Quantite],([SommeDeNbMots]-[Quantite])/[Quantite],([Quantite]-[SommeDeNbMots])/[SommeDeNbMots])
AS Expr2
FROM reqNbMotsAffectesParDetailParService INNER JOIN
reqNbMotsParDetailParService ON
(reqNbMotsAffectesParDetailParService.CodeService =
reqNbMotsParDetailParService.CodeService) AND
(reqNbMotsAffectesParDetailParService.CodeDetail =
reqNbMotsParDetailParService.CodeDetail)
WHERE
(((IIf([SommeDeNbMots]>[Quantite],([SommeDeNbMots]-[Quantite])/[Quantite],([Quantite]-[SommeDeNbMots])/[SommeDeNbMots]))>0));
</code>
It's a bit complex if you don't know what it supposed to do, so I'll
explain what it do. It takes the data from two queries, join them
together and compute a result (Expr2) based on some data coming from
both tables.
The computation involve an IIF with some division :
<code>
IIf([SommeDeNbMots]>[Quantite],([SommeDeNbMots]-[Quantite])/[Quantite],([Quantite]-[SommeDeNbMots])/[SommeDeNbMots])
</code>
I already know that no mater what the condition evaluates to, both parts
of the IIF get evaluated. However, in the originals queries, "Quantite"
and "SommeDeNbMots" are never equal to zero, so there should be no problem.
Furthermore if I remove the WHERE clause, the query return a result
without any error.
Even more odds : If I change the condition in the where clause for ">1"
I get the division by zero error then the query stay in design mode, if
I change the condition for "<1" (Note the lesser than) I get the same
error, but the query is now in view mode with "#name" written in every
fields of the only visible row (Same behavior than with ">0").
Can someone help me with this problem?
Mathieu Pagé
(e-mail address removed)