If you can be sure you will have a StatePct record for each month, then you could use this:
Code:
QueryStateData2
SELECT
TS.StateName As DataLocation,
TD.DataDate,
TD.ProductType,
TD.DataCode,
Round(TS.StatePct * TD.DataAmount,0) AS DataAmount
FROM
tblData as TD,
tblStatePct AS TS
WHERE
TD.DataLocation = "National"
AND TD.ProductType = TS.ProductType;
AND TD.DataDate = TS.DataDate;
If you can't be sure you will have a StatePct record for each month, then you would use something like this:
Code:
QueryStateData3
SELECT
TS.StateName As DataLocation,
TD.DataDate,
TD.ProductType,
TD.DataCode,
Round(TS.StatePct * TD.DataAmount,0) AS DataAmount
FROM
tblData as TD,
tblStatePct AS TS
WHERE
TD.DataLocation = "National"
AND TD.ProductType = TS.ProductType
AND TS.DataDate =
(SELECT MAX (TS2.DataDate)
FROM tblStatePct as TS2
WHERE TS2.DataDate <= TD.DataDate
AND TS2.ProductType = TD.ProductType);
I can't be positive about the last one, but I think I got it right. You want to multiply each TD record by the latest TS record for the same product that is no earlier than the TD record. The subselect determines the date desired for that TS record, and then the SELECT handles the rest.