Van,
I have to respectfully disagree.
NPV is actually in VBA. Unfortunately, it is only available through VBA, not
in Access objects like queries.
The article at
http://support.microsoft.com/default.aspx?scid=kb;en-us;268159 describes how
to make a "wrapper" function so that it can be used in Access objects.
Mark,
You have a couple of problems. One easy. One not-so-easy.
1 - Help states that the first argument is a decimal. What they mean is that
5% must be entered as .05, not 5. (The easy one.)
2 - The second argument is an array. (The not-so-easy one.)
From your sample, I get the impression that all of the values are in
separate records and you are somehow expecting the query to magically
assemble them for you. If this is the case, you're not going to be able to
use this function in a query. Queries work row-by-row. It's going to require
some more code to read the values from separate records and then assemble
them into an array.
If all of your values were in separate fields in the same record, (breaking
all of the normalization rules,) you could use this function by simply
specifying each of the fields as a separate argument.
There might be a way to pull this off by using a crosstab query to flatten
the records and then put this function into another query based on the
crosstab query. This just might be more work than writing some more code.
Good luck.
Sco
Van T. Dinh said:
I think NPV is an Excel function and not an Access function.
If you want to use the Excel NPV, create an Excel object and then use the
NPV function via this Excel object.
--
HTH
Van T. Dinh
MVP (Access)
I have a query and I want to use NPV function. The
Expression Builder I use the following statement:
Exp1: NPV(5,[Total Costs]![Incremental Benefits])
5% is the discount rate
The field [Incremental Benefits] is where each year's
value is
Why does access say the function is not defined in the
expression?
Thanks
Mark