Solved Syntax error in DSum

zelarra821

Registered User.
Local time
Today, 17:04
Joined
Jan 14, 2019
Messages
860
Buenas tardes. I'm trying to add a field based on some criteria, and it gives me the error #Name?.

I pass you the database. It is the FGestionDeProyectos form, in the field at the bottom that says Gastos and also in the Ingresos field.

Thanks
 
in the field at the bottom that says Gastos and also in the Ingresos field.
Please write - What are you trying to show in this field?
Your expression:
Code:
=DSum([Gastos];[CGastosEIngresos]; "IdCategoria=2 And IdImporte=" & [IdImporte])
Can't work because there is no "[CGastosEIngresos]" field in the "[Gastos]" query
 
The "#Name" error is because you incorrectly named something. There is no IdImporte in the CCastosEIngresos query so... Access can't find the thing you named.
 
Did you look at the error message by clicking the yellow triangle on the field? It told you about the circular reference and even what field was causing it:) Rename the field to something else and also fix the error Doc pointed out
 
Please write - What are you trying to show in this field?
I want the formula to add the amounts that meet the criteria IdCategoria = 2 and IdImporte the one you choose from the dropdown

There is no IdImporte in the CCastosEIngresos query so... Access can't find the thing you named.
Fixed. I have put all the fields of the query, exactly as I want, and it keeps giving me the same error.

=DSuma([Importe];[CGastosEIngresos];"IdCategoria=2 And IdProyecto=" & [IdProyecto])
 
Did you look at the error message by clicking the yellow triangle on the field? It told you about the circular reference and even what field was causing it:) Rename the field to something else and also fix the error Doc pointed out
I don't get any yellow triangle. I have tried to change the name to IdProyecto in the query, but it keeps giving an error.
 
Sorry, it's green. And you fixe that error by changing the Control Name to something other than the name of a field in the form's control source. Gastos is the name of a bound field so you can use it as the name of a control bound to the field named Gastos but you cannot use it as the name of an unbound control.
xxxError.JPG


You only tried to fix ONE error. What error did that raise. We have no shot at helping without knowing what errors you get.

BTW, I can't open the database without getting errors about some custom UI.
 
I don't get any yellow triangle. I have tried to change the name to IdProyecto in the query, but it keeps giving an error.
Try that expression:
Code:
=Nz(DSum("Importe";"CGastosEIngresos";"IdCategoria=2 And IdProyecto=" & Nz([IdProyecto];0));0)
 

Users who are viewing this thread

Back
Top Bottom