Ok i thought i understood the first part of your answer and changed it to the following:
Public Function GetVatValue()
Dim VatAmount As Double
VatAmount = Nz(DLookup("VatRate", "TblVat", "DateFrom>= #" & TaxDate & "# AND DateTo <= #" & TaxDate & "# And DocumentNo = " & DocumentNo), 0)
End...