Gasman
Enthusiastic Amateur
- Local time
- Today, 00:36
- Joined
- Sep 21, 2011
- Messages
- 16,610
Hi everyone,
Why do I get a Byref argument Type mismatch with this from the Immediate window
yet
runs and produces the correct result?
First line of function is
Why do I get a Byref argument Type mismatch with this from the Immediate window
Code:
st=#3/13/2017#
en=#4/12/2017#
? vartype(st)
7
? vartype(en)
7
? calcbonus(19,st,en,1) ' error when I try this?
Code:
Sub testCalcBonus()
Dim curBonus As Currency
TempVars("BonusAmt") = 0
TempVars("BonusCount") = 0
'TempVars("Bonus") = CalcBonus(19, #3/27/2017#, #3/27/2017#, 2)
TempVars("BonusAmt") = CalcBonus(19, #3/13/2017#, #4/12/2017#, 1)
MsgBox "Bonus " & TempVars("BonusAmt") & " for count of " & TempVars("BonusCount")
End Sub
First line of function is
Code:
Public Function CalcBonus(plngEmployeeID As Long, pdtStartDate As Date, pdtEndDate As Date, piBonusPeriod As Integer)