Way out of my depth here so all help gratefully received. I have an application that requires multiple calculations on any particular record and my function takes details from the open form, calculates and returns the values in an array - works great. Problem I have now is that I would like to re-use the function and rather than take values from the form I would like to pass arguments to the function. Is it possible? If so how as any argument is interpreted as a value returned from the array?
Public Function thruDUE()
Dim vEarly As Date
Dim vLate As Date
Dim vCurrent As Currency
Dim vMin As Currency
Dim vMax As Currency
Dim vArrearsbf As Currency
Dim vArrearscf
Dim vQdue
Dim vTotdue
Dim vBalance
Dim vInfo
if IsOpen("Main Property") then
vEarly=month([forms]![mainproperty]![vDate1])
vLate=year([forms]![mainproperty]![vDate1])
vMin=[forms]![mainproperty]![vDue1]/1.75
vMax=[forms]![mainproperty]![vDue2]*1.75
vArrearsbf=[forms]![mainproperty]![vArr1]+[forms]![mainproperty]![varr2]
vQdue=[forms]![mainproperty]![vDue1]+[forms]![mainproperty]![vDue2]
vTotdue=vArrearsbf+vQdue
vBalance=vTotdue-[forms]![mainproperty]![vPaid]
end if
' Note - can we replace forms data with arguments?
vInfo = Array(vMin, vMax, vEarly, vLate, vCurrent, vArrearsbf, vQdue, vTotdue, vBalance)
thruDUE = vInfo
End Function
Public Function thruDUE()
Dim vEarly As Date
Dim vLate As Date
Dim vCurrent As Currency
Dim vMin As Currency
Dim vMax As Currency
Dim vArrearsbf As Currency
Dim vArrearscf
Dim vQdue
Dim vTotdue
Dim vBalance
Dim vInfo
if IsOpen("Main Property") then
vEarly=month([forms]![mainproperty]![vDate1])
vLate=year([forms]![mainproperty]![vDate1])
vMin=[forms]![mainproperty]![vDue1]/1.75
vMax=[forms]![mainproperty]![vDue2]*1.75
vArrearsbf=[forms]![mainproperty]![vArr1]+[forms]![mainproperty]![varr2]
vQdue=[forms]![mainproperty]![vDue1]+[forms]![mainproperty]![vDue2]
vTotdue=vArrearsbf+vQdue
vBalance=vTotdue-[forms]![mainproperty]![vPaid]
end if
' Note - can we replace forms data with arguments?
vInfo = Array(vMin, vMax, vEarly, vLate, vCurrent, vArrearsbf, vQdue, vTotdue, vBalance)
thruDUE = vInfo
End Function