|
Question : Sum in datasheet subform with dlookup fields
|
|
I have a datasheet subform with some controls that have a calculated value utilizing the dlookup function. However, as I discovered, I can not simply sum this column up by placing a sum function in the form footer with the appropriate dlookup formulas in it. Therefore, I need to find a solution as to how to add up such fields so that I can stop banging my head against my keyboard.
|
|
Answer : Sum in datasheet subform with dlookup fields
|
|
Since ingredient is the name of a field, you need to seperate it out of the quotes, so that the value contained in the field, (not the literal text "[Ingredient]") is used. Try revising your DLookup like this (assuming Ingredient is text -- let me know if it is numeric):
Cost: DLookUp("ProductCost","tblProducts","tblProducts!ProductName='" & [Ingredient] & "'")
|
|
|
|