Advertisement
Advertisement
| 08.27.2008 at 01:03PM PDT, ID: 23683365 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: |
Option Compare Database
Sub jj()
Dim db As DAO.Database
Dim dIRRresult As Double
Dim dNPVResult As Double
Dim lDiscountRate As Double
Dim objExcel As Excel.Application
Dim ArrDates() As Long
Dim ArrAmounts() As Long
Dim lRecordCount As Long
Dim intCounter As Long
' Initialise the Excel application and register the Analysis toolpak file
Set objExcel = New Excel.Application
objExcel.RegisterXLL objExcel.Application.LibraryPath & "\ANALYSIS\ANALYS32.XLL"
strsql = "SELECT Sheet2.[Perdat], Sheet2.[Tot] FROM Sheet2;"
'Initialise the database and the recordset
Set db = CurrentDb
Set rs = db.OpenRecordset(strsql, dbOpenDynaset)
lRecordCount = rs.RecordCount
MsgBox lRecordCount
'read the values into the array only of there is more than one value in the cash flow stream. Otherwise the 'functions would not work anyway.
If lRecordCount > 1 Then
'Initialize the arrays which hold the period and cashflow numbers using the recordcount of the recordset
ReDim ArrDates(1 To lRecordCount) As Long
ReDim ArrAmounts(1 To lRecordCount) As Long
'Read the period and cashflow values from the recordset and put them in the arrays.
For intCounter = 1 To lRecordCount
ArrDates(intCounter) = CLng(CDate(rs!Perdat))
ArrAmounts(intCounter) = rs!Tot
rs.MoveNext
Next intCounter
'Read the Discount rate (for calculating NPV) from wherever you store it.
'This is the actual call to the XIRR function.
dIRRresult = IIf(IsError(objExcel.Run("XIRR", ArrAmounts, ArrDates)), 0, objExcel.Run("XIRR", ArrAmounts, ArrDates))
End If
rs.MoveNext
MsgBox dIRRresult
objExcel.Quit
Set objExcel = Nothing
End Sub
|