F
Forrest
My goal is to have a Access2002 form/report show the IRR
(internal rate of return) of a series of distributions
stored in an Access table. The table looks like:
Name Date Amount
Alloy Corp. 4/4/2000 ($5.00)
Alloy Corp. 12/2/2002 $2.00
Alloy Corp. 6/11/2003 $3.00
Alloy Corp. 5/3/2002 $4.00
Alloy Corp. 3/31/2003 $5.00
The following code on my form produces a result
referencing the current record:
Private Sub xlAverage_Click()
Dim objExcel As Excel.Application
Dim dbs As Database
Dim rst As Recordset
Dim N As Long
Dim recno As Long
Set objExcel = CreateObject("Excel.Application")
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("AlloyIRRForrest")
MsgBox objExcel.Application.WorksheetFunction.Average
([Amount])
objExcel.Quit
Set objExcel = Nothing
End Sub
My challenge; 1)I need to get the average of all records,
and 2)I need to reference the IRR function which will
involve two fields.
Thanks for any suggestions.
Forrest
(internal rate of return) of a series of distributions
stored in an Access table. The table looks like:
Name Date Amount
Alloy Corp. 4/4/2000 ($5.00)
Alloy Corp. 12/2/2002 $2.00
Alloy Corp. 6/11/2003 $3.00
Alloy Corp. 5/3/2002 $4.00
Alloy Corp. 3/31/2003 $5.00
The following code on my form produces a result
referencing the current record:
Private Sub xlAverage_Click()
Dim objExcel As Excel.Application
Dim dbs As Database
Dim rst As Recordset
Dim N As Long
Dim recno As Long
Set objExcel = CreateObject("Excel.Application")
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("AlloyIRRForrest")
MsgBox objExcel.Application.WorksheetFunction.Average
([Amount])
objExcel.Quit
Set objExcel = Nothing
End Sub
My challenge; 1)I need to get the average of all records,
and 2)I need to reference the IRR function which will
involve two fields.
Thanks for any suggestions.
Forrest