Currency type fields cannot handle Nulls. I think that only Variants can contain nulls. One way to deal with Nulls is to use the NZ() function (null to zero). In VBA, you should use the IsNull() function to check for Nulls.
Code:
Dim Price As Currency
Price = Nz(DLookup("[CostUnit]", "qryAvgIngredientCost", "[Item_ID] = " & CurrentItem), 0)
' If IsNull(Price) Then
If Price = 0 Then
MsgBox ("Item not found. Cost calculation will be incomplete.")
Else
' Calculations
End If
or
Code:
Dim Price As Currency
Dim LookTest As Variant
LookTest = DLookup("[CostUnit]", "qryAvgIngredientCost", "[Item_ID] = " & CurrentItem)
If IsNull(LookTest) Then
MsgBox ("Item not found. Cost calculation will be incomplete.")
Else
Price = LookTest
' Calculations
End If
End Sub