londonkiwi
Programmer
I'm trying to refer to fields within query "qryCost" to evaluate the value of ETC. I have a field in qryCost ExpectedTC: ETC(). However when I run the query all it returns in the EpectedTC field is 0.
Would appreciate any advice. Do I use DLookup... and if so how. cheers
Function ETC()
Dim TenderPrice As Double ' field in query
Dim Cost As Double ' field in query
Dim Budget As Double ' field in query
ETC = 0
If IsNull(TenderPrice) Or TenderPrice = 0 Then ' no tender price available
If Cost > Budget Then ' costs exceed budget
ETC = Cost
Else
ETC = Budget
End If
ElseIf TenderPrice > Budget Then
If Cost > TenderPrice Then ' costs > tender
ETC = Cost
Else
ETC = TenderPrice ' tender > costs
End If
ElseIf TenderPrice < Budget Then
If Cost > TenderPrice Then ' costs > tender
ETC = Cost
Else
ETC = TenderPrice '
End If
End If
End Function
Would appreciate any advice. Do I use DLookup... and if so how. cheers
Function ETC()
Dim TenderPrice As Double ' field in query
Dim Cost As Double ' field in query
Dim Budget As Double ' field in query
ETC = 0
If IsNull(TenderPrice) Or TenderPrice = 0 Then ' no tender price available
If Cost > Budget Then ' costs exceed budget
ETC = Cost
Else
ETC = Budget
End If
ElseIf TenderPrice > Budget Then
If Cost > TenderPrice Then ' costs > tender
ETC = Cost
Else
ETC = TenderPrice ' tender > costs
End If
ElseIf TenderPrice < Budget Then
If Cost > TenderPrice Then ' costs > tender
ETC = Cost
Else
ETC = TenderPrice '
End If
End If
End Function