This Public Function Works in the immediate window.
But when used in another Function
Error message is:
Compile error:
Sub or Function not defined
Appreciate any advise on where I went wrong. Code Compiles without error.
This is the code I would like to get it working in but would be happy just to get the test code above working.
Code:
?LoanBalanceToDate("7869", "7/29/2010")
But when used in another Function
Code:
Private Function TestLateFees()
Dim LateFees As Currency
LateFees = LoanBalanceToDate("7869", "4/29/2010")
End Function
Error message is:
Compile error:
Sub or Function not defined
Appreciate any advise on where I went wrong. Code Compiles without error.
This is the code I would like to get it working in but would be happy just to get the test code above working.
Code:
Private Function GetLateFees() As Currency
Dim LoanID As String
Dim LateFeesNew As Currency
Dim TransDate As Date
Dim LateFeeRate As Currency
Dim RepayAmount As Currency
Dim LoanBalance As Currency
LateFeesNew = 0 'Set Variable to Zero
LoanID = Me.LDPK 'Set Current Reord LDPK on Form to be Variable LoanID
TransDate = DLookup("[LDSt]", "TBLLOAN", "LDPK=" & [LoanID]) 'Set First Repayment Due Date of Loan As Variable TransDate
LateFeeRate = DLookup("[LoanLateFee]", "TBLLOAN", "LDPK=" & LoanID) 'Set Late Fee Amount for this Loan As Variable LateFeeK
RepayAmount = DLookup("[LDPayK]", "TBLLOAN", "LDPK=" & LoanID) 'Set Repay Amount for this Loan As Variable RepayAmount
LoanBalance = LoanBalanceToDate("LoanID", "TransDate") 'Set Loan Balance as at First Repay Date of Loan
GetLateFees = LoanBalance
End Function