473,473 Members | 1,548 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Would like to use IRR in a Query using MS Access

4 New Member
I'm trying to use the IRR function in Ms Access using the code below.

Function MyIRR(mygroupid, myguess) as double
Dim Values(4) as double' an array with 5 elements
Dim x

dim rs as dao.recordset
set rs = currentdb.openrecordset("Select * from Myquery where Fundid =" & mygroupid)
rs.movefirst ' should only be one record

for x = 0 to 4
Values(x) = rs(x+1)
next x

MyIRR = IRR(Values(),myguess)

rs.close
set rs = nothing

End Function

In this procedure I having a query(MYQuery) to group on the first column which is FundiD.


I Created a second query (Myquery1)using the group query as source and included all fields plus an extra column to calculate My IRR.
The extra column in the second query(Myquery1) looks like this :IRRVal:MyIRR(FundID, .10)

1st Qry fiedls are: FundiD, CapCallAmt,Dictributions, Net asset Value and Cashflow. ( cashflow is the sum of the fields in the row) The problem is, when i run the query error # 3061 Run Time error and To few parameters Expected 1 . Can anyone help.

I'm stuck for the last 3 days. Now learing to use Visual Basic.
Jan 3 '08 #1
1 2678
ADezii
8,834 Recognized Expert Expert
I'm trying to use the IRR function in Ms Access using the code below.

Function MyIRR(mygroupid, myguess) as double
Dim Values(4) as double' an array with 5 elements
Dim x

dim rs as dao.recordset
set rs = currentdb.openrecordset("Select * from Myquery where Fundid =" & mygroupid)
rs.movefirst ' should only be one record

for x = 0 to 4
Values(x) = rs(x+1)
next x

MyIRR = IRR(Values(),myguess)

rs.close
set rs = nothing

End Function

In this procedure I having a query(MYQuery) to group on the first column which is FundiD.


I Created a second query (Myquery1)using the group query as source and included all fields plus an extra column to calculate My IRR.
The extra column in the second query(Myquery1) looks like this :IRRVal:MyIRR(FundID, .10)

1st Qry fiedls are: FundiD, CapCallAmt,Dictributions, Net asset Value and Cashflow. ( cashflow is the sum of the fields in the row) The problem is, when i run the query error # 3061 Run Time error and To few parameters Expected 1 . Can anyone help.

I'm stuck for the last 3 days. Now learing to use Visual Basic.
You may want to take a look at this Post:
How to Calculate the IRR in Access
Jan 6 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

29
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules"...
6
by: Mahesh Hardikar | last post by:
Hi , Oracle 8.1.7.0.0 on HP-UX 11.0 I am a newbie as far as PL-SQL is concerned . I have Sybase/MSSQL T-SQL background. We have a report which uses a select statement . This select...
0
by: LesM | last post by:
This is a change of behaviour between Access 2000 SP3 and Access 2002 SP3. I have Progress table that is linked via ODBC into Access using OpenLink Lite for Progress 9.0b. For over a year, using...
6
by: Access Newbie | last post by:
I'm using Access 2000 and I'm trying to create a pass-through query to append all the data from a local table to a remote table. I'm using the SQL query editor in MS Access to create the query (I...
1
by: Suzi Carr | last post by:
Hello, We create querydefs in VB programs (i.e. CreateQueryDef). But as illustrated below, Access regenerates the SQL code we specify -- particularly the WHERE clause. While the new code is...
9
by: Mike Bridge | last post by:
I am using MS Access 2003, and I typed in a query in SQL view which was working fine. Now when I open it, it gives me the error "Join expression not supported". Apparently, Access "fixed" it for...
2
by: Julie Wardlow | last post by:
Help! I am calculating a future date using the DateAdd function in a query (the calculation also involves an IIf statement), and have managed to get this formula to produce the required result....
7
by: John Øllgård Jensen | last post by:
Hi Using MS Asccess 2000: In a query I'm trying to create a new field with following expression: FilmDate: Left(,4) The field "FilmNo" is another text field in the query. This is...
8
by: Roland Hall | last post by:
In Access you use "*" + + "*", + can be replaced with & Calling a parameterized query in Access requires % be used in place of *, however, all that I have read show dynamic SQL passed to Access: ...
14
by: Rich P | last post by:
Hi Sara, If you try it this way - you may have better luck Dim strSql As String strSql = "INSERT INTO tblPOCancels ( PONum, PODate, DateEntered, MerchantKey,VendorKey, POApproved, " _ &...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.