IRR Function in Access?

G

Gearman

Hi,

How can I use IRR function in MS Access? I've tried but all I get is
"#name?". Please help.

BR
-G.
 
A

Arvin Meyer

You can use it from Access, but you'll need to set a reference to Excel,
then write an Access function like (air code):

Function XL_IRR(Arg1, Optional Arg2) as double
Dim objXL As New Excel.Application
' Arg2 is optional below. (Leave out the comma too)
XL_IRR= objXL.WorksheetFunction.IRR(Arg1,Arg2)
Set objXL = Nothing
End Sub

And pass it the values and Optionally the guess.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access Downloads
http://www.datastrat.com
http://www.mvps.org/access
 
J

Jari

I would like to ask still on this problem. I am not too familiar with the
visual basic and don't seem to get this code working. I did set the reference
to excel. Then I did a new module and copied the code there. On Access query
I chose this function and gave a field name where the function would get the
values from. And it doens't work... I also tried to change the code a bit and
changed the end to 'end function'. I received run time error 1004, couldn't
use the class worksheet function IRR.

Obviously I am doing something wrong. But what??

Help is appreciated,
Jari



"Arvin Meyer" kirjoitti:
 
Top