I have a calculated field in a table that needs to take the value from another table but in the expression generator window it doesn't allow me to choose values from other tables.
Then, I tried to create a form from the table, and put in the source control the function that I need but it triggers a #Name?
Error in the form.
This is the code that I put in the source control (Iff function) :
=IIf([Stato]="Vendita";[Costo ivato 1 pezzo]+(([Costo ivato 1 pezzo]/100)*[Provv_Vendita]![Costo]);[Costo ivato 1 pezzo]+(([Costo ivato 1 pezzo]/100)*[Provv_Prevendita]![Costo]))
[Stato]
and [Costo ivato 1 pezzo]
are two fields that are in the same table (called Prodotti
) that is structured like this:
Stato Costo Ivato 1 pezzo
Vendita 10
Prevendita 20
The other table (called Provvigioni
) is like
Tipo Costo
Vendita 1,5
Prevendita 5
Provv_Vendita
and Provv_Prevendita
are two queries that select the values that I need and are structured like this
SELECT Provvigioni.Costo
FROM Provvigioni
WHERE Provvigioni.Tipo="Vendita";
Is there a way to take the field from the other table and use in a function on the first table?
#Name?
error on your form, because the fields you've referenced in yourIFF
statement don't exist on the form (i.e. you haven't given the form a Record Source that refers to a table/query containing those fields). 3) In the Provvigioni table you've said thatVendita
has aCosto
of "1,5"... is it meant to be this or is it 1.5? 4) YourIIF
statement would be better suited to a query (see my answer below). – Matt Hall