Argument not optional error

L

Leslie Coover

Why do I get "argument not optional error" in

Case MF
If DD <= 365 Then
LowMFrate
DiscRate = LowMFrate
Else
DiscRate = HiMFrate

---------------------------------------------------------

Option Compare Database
Option Explicit

Dim DD As Double

'references = Visual Basic For Applications,
' = Microsoft Access 9.0 Object Library
' = OLE Automation
' = Microsoft ActiveX Data Objects 2.1 Library
' = Microsoft DAO 3.6 Object Library

Function DiscRate(Purchase_Price As Currency, _
Pro_Cur_Val As Currency, DD As Double, _
TypeS As String, SumOfCashFlow As Currency, Coupon As Double, M As Double)
As Double
Dim MF As String
Select Case TypeS

Case MF
If DD <= 365 Then
LowMFrate
DiscRate = LowMFrate
Else
DiscRate = HiMFrate

End If
Case Else
End Select


End Function

Function LowMFrate(Purchase_Price As Currency, Pro_Cur_Val As Currency) As
Double
Dim MyTemp As Double
MyTemp = (Pro_Cur_Val / Purchase_Price) - 1
LowMFrate = MyTemp

End Function

Function HiMFrate(Purchase_Price As Currency, Pro_Cur_Val As Currency, _
DD As Double) As Double
Dim MyTemp As Double
MyTemp = ((Pro_Cur_Val / Purchase_Price) ^ (1 / (DD / 365))) - 1
HiMFrate = MyTemp

End Function


Thanks!!!
 
K

Ken Snell \(MVP\)

Because the LowMFrate function expects two arguments to be passed to it.
Note the first line of the Function:

Function LowMFrate(Purchase_Price As Currency, Pro_Cur_Val As Currency) As
Double


The function expects you to give it the values for Purchase_Price and for
Pro_Cur_Val.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top