Attempting to use NPV function in Access 97. I keep getting this error. Dispite the fact that I believe I'm using the function properly, as well as setting up the array correctly.
pretty straight forward as far as I can tell. I keep getting a Subscript out of range on the NPV function statement. specfically the "NPVarray()" part.
pretty straight forward as far as I can tell. I keep getting a Subscript out of range on the NPV function statement. specfically the "NPVarray()" part.
Code:
Private Sub calc_adjustment_Click()
Dim dbs As Database
Dim rst As Recordset
Dim strsql As String
Dim NPVarray
Dim Count, n As Integer
Dim value, interest As Double
Set dbs = CurrentDb
With [Forms]![frm_Merge=Yes Data Entry]
Count = ![MonthsToGo]
ReDim NPVarray(Count) As Double
value = ![CurrentBalance]
interest = InputBox("Enter the interest rate.", "Calculate Rent Adjustment") / 100
n = 0
NPVarray(n) = value * Count * -1
n = n + 1
While n <= Count
NPVarray(n) = value
n = n + 1
Wend
n = 0
![npv] = npv(interest, NPVarray())
End With
End Sub