Access Query and Management of Empty Fields

charlyez Posted messages 7 Status Member -  
yg_be Posted messages 23437 Registration date   Status Contributor Last intervention   -
Hello,

I created a database containing many tables and queries.

Currently, I have an issue with a query. The SQL code for the query is as follows:

SQL Code:

SELECT DISTINCT Sum([Besoins]![Puissance réelle]) AS Expr1, Besoins.NUM_SI FROM Besoins GROUP BY Besoins.NUM_SI, [Besoins]![Date prévisionnelle] Between DateAdd("q",+1,Now()) And Now(), Besoins.[Type de courant] HAVING (((Besoins.NUM_SI)=[Formulaires]![Etat des lieux]![NuméroSI] Or (Besoins.NUM_SI)=[Formulaires]![Etat des lieux]![NuméroT]) AND ((Besoins.[Type de courant])="48") AND (([Besoins]![Date prévisionnelle]) Between DateAdd("q",+1,Now()) And Now()));


The principle of operation is:
The query is made on a table named BESOIN.
Depending on the date and a number (Numéro SI) which serves as a key, the query displays a value.
When there is no value, the field is empty.

I am trying to set the value of this field to 0, but I can't get it to work.
I tried an IIf and the NZ function, but without results. Do you have any solutions?

Thank you in advance.

6 answers

yg_be Posted messages 23437 Registration date   Status Contributor Last intervention   Ambassadeur 1 588
 
Hello,
does your request work well except that it sometimes returns a null value for one of the two results (which one)?
show us what you have tried, that might help us understand what you want to achieve.
also explain what you got for each attempt. "without result," do you mean: with a result different from what you want?
when you write "the field" and "this field," wouldn’t it be clearer if you specified which field you are talking about? what is the type of this field?
isn't there also a form that you haven't mentioned?
0