Make it a function. The following is a bit more generic. You'd call it as:
MyIrr("CashFlow", "MyTable", 0.1)
Function MyIrr( _
FieldName As String, _
TableName As String, _
Optional Guess As Double = 0.1 _
) As Double
On Error GoTo Err_MyIrr
Dim dbCurr As DAO.Database
Dim rsCurr As DAO.Recordset
Dim intLoop As Integer
Dim dblValues() As Double
Dim strSQL As String
strSQL = "SELECT [" & FieldName & "] " & _
"FROM [" & TableName & "]"
Set dbCurr = CurrentDb()
Set rsCurr = dbCurr.OpenRecordset(strSQL)
rsCurr.MoveLast
rsCurr.MoveFirst
ReDim dblValues(0 to rsCurr.RecordCount - 1)
intLoop = 0
Do Until rsCurr.EOF
dblValues(intLoop) = rsCurr!CashFlow
intLoop = intLoop + 1
rsCurr.MoveNext
Loop
MyIrr = Irr(dblValues, Guess)
End_MyIrr:
On Error Resume Next
rsCurr.Close
Set rsCurr = Nothing
Set dbCurr = Nothing
Exit Function
Err_MyIrr:
Err.Raise Err.Number, "MyIrr", Err.Description
Resume End_MyIrr
End Function

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
> Thanks, Doug:
>
[quoted text clipped - 26 lines]
>>>
>>> Dane
Tom Wickerath - 25 Feb 2007 23:24 GMT
Hi Doug,
I think to make your function truly generic, you'll want to make the
indicated substitution, instead of hard-coding the field name "CashFlow":
Do Until rsCurr.EOF
dblValues(intLoop) = rsCurr(Eval("'[" & FieldName & "]'")) '<-----
' dblValues(intLoop) = rsCurr!CashFlow
intLoop = intLoop + 1
rsCurr.MoveNext
Loop
Tom Wickerath
Microsoft Access MVP
http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________
> Make it a function. The following is a bit more generic. You'd call it as:
>
[quoted text clipped - 41 lines]
>
> End Function
Douglas J. Steele - 26 Feb 2007 01:05 GMT
Good catch, Tom.
dblValues(intLoop) = rsCurr.Fields(0)
will do as well, or you could use
strSQL = "SELECT [" & FieldName & "] AS Field1" & _
"FROM [" & TableName & "]"
and
dblValues(intLoop) = rsCurr!Field1

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
> Hi Doug,
>
[quoted text clipped - 61 lines]
>>
>> End Function