I have 4 fields which have certain dates in it. Each date (regardless of what date it is) signifies the rate of progress. So I have following rate:
Survey ordered: 60%
Layout Ordered: 30%
Signage ordered: 5%
Refrigeration ordered: 5%
I would like to sum the percentages depending on the dates in each field filled in.
I tried to create a formula in the query but not too sure how to combine the result. So I thought might as well seek some help in building a function instead. Following is my effort. This only gives me one whole number where it meeting all 4 conditions. But zero elsewhere.
Survey ordered: 60%
Layout Ordered: 30%
Signage ordered: 5%
Refrigeration ordered: 5%
I would like to sum the percentages depending on the dates in each field filled in.
I tried to create a formula in the query but not too sure how to combine the result. So I thought might as well seek some help in building a function instead. Following is my effort. This only gives me one whole number where it meeting all 4 conditions. But zero elsewhere.
Function Rate(varSpeDateOrd As Variant, VarPrimSecOrd As Variant, varSignOrderDate As Variant, varRefOrderDate As Variant) As Integer
Dim var1 As Variant
Dim var2 As Variant
Dim var3 As Variant
Dim var4 As Variant
If Not IsNull(varSpeDateOrd) Then
var1 = 0.6
ElseIf Not IsNull(VarPrimSecOrd) Then
var2 = 0.4
ElseIf Not IsNull(varSignOrderDate) Then
var3 = 0.05
ElseIf Not IsNull(varRefOrderDate) Then
var4 = 0.05
End If
Rate = CInt(var1 + var2 + var3 + var4)
End Function