S
Sue
Hi all
I have a table holding data over the last twelve months, with a parts and
labour total per item. The table holds data for all European countries and
each record has a CountryCode field and ClaimNo as its key. These totals
include VAT, I need to calculate a NET total in a query for analysis. The
VAT rates are held in a table called [tbl VAT Rates]. This has 3 fields:
CountryCode (same as totals data table), EffectiveDate and VATRate. There
can be more than one record per country, it is keyed on Country and
EffectiveDate. I need to calculate the VAT based on a payment date in the
totals table.
For example I might have a record for country UK paid on 31/03/10, the VAT
table has two records for the UK - one Effective Date of 01/01/01 as 15% and
another of 01/02/10 with 0% (ie no VAT charged). In this example it would
need to use the 0% value to calculate the NET total of labour and parts.
Can I achieve this in a query? I have tried playing with dlookup, but the
problem is I think it needs to return the Max of EffectiveDate, which is
less than the paymentdate - and my brain is just not working!!! Can anyone
help please?
I have a table holding data over the last twelve months, with a parts and
labour total per item. The table holds data for all European countries and
each record has a CountryCode field and ClaimNo as its key. These totals
include VAT, I need to calculate a NET total in a query for analysis. The
VAT rates are held in a table called [tbl VAT Rates]. This has 3 fields:
CountryCode (same as totals data table), EffectiveDate and VATRate. There
can be more than one record per country, it is keyed on Country and
EffectiveDate. I need to calculate the VAT based on a payment date in the
totals table.
For example I might have a record for country UK paid on 31/03/10, the VAT
table has two records for the UK - one Effective Date of 01/01/01 as 15% and
another of 01/02/10 with 0% (ie no VAT charged). In this example it would
need to use the 0% value to calculate the NET total of labour and parts.
Can I achieve this in a query? I have tried playing with dlookup, but the
problem is I think it needs to return the Max of EffectiveDate, which is
less than the paymentdate - and my brain is just not working!!! Can anyone
help please?