D
dustinb via AccessMonster.com
I have a DB that I would like to pull the correct rate from tblOcean that
corresponds to the each shipment in qryGetBasePerContainer. I am trying to
do this by putting a criteria on Effective Date and saying I want to see the
Max effective date that is less than the freight tender date. To me that
sounds like it should work but instead of pulling just one rate from Table
ocean to go with each shipment it pulls nothing because the Max of
EffectiveDate is greater than the freight tender. If you need more details
please ask. Thank you.
SELECT qryGetBasePerContainer.[Broker ref #], qryGetBasePerContainer.
[Container #], Max(tblOcean.EffectiveDate) AS [Effective Date]
FROM tblOcean LEFT JOIN qryGetBasePerContainer ON (tblOcean.Mode =
qryGetBasePerContainer.Mode) AND (tblOcean.ContainerSize =
qryGetBasePerContainer.[Container size]) AND (tblOcean.Origin =
qryGetBasePerContainer.[Port of export]) AND (tblOcean.Forwarder =
qryGetBasePerContainer.Forwarder)
GROUP BY qryGetBasePerContainer.[Broker ref #], qryGetBasePerContainer.
[Container #], qryGetBasePerContainer.[Freight tender date]
HAVING (((Max(tblOcean.EffectiveDate))<[qryGetBasePerContainer]![Freight
tender date]));
corresponds to the each shipment in qryGetBasePerContainer. I am trying to
do this by putting a criteria on Effective Date and saying I want to see the
Max effective date that is less than the freight tender date. To me that
sounds like it should work but instead of pulling just one rate from Table
ocean to go with each shipment it pulls nothing because the Max of
EffectiveDate is greater than the freight tender. If you need more details
please ask. Thank you.
SELECT qryGetBasePerContainer.[Broker ref #], qryGetBasePerContainer.
[Container #], Max(tblOcean.EffectiveDate) AS [Effective Date]
FROM tblOcean LEFT JOIN qryGetBasePerContainer ON (tblOcean.Mode =
qryGetBasePerContainer.Mode) AND (tblOcean.ContainerSize =
qryGetBasePerContainer.[Container size]) AND (tblOcean.Origin =
qryGetBasePerContainer.[Port of export]) AND (tblOcean.Forwarder =
qryGetBasePerContainer.Forwarder)
GROUP BY qryGetBasePerContainer.[Broker ref #], qryGetBasePerContainer.
[Container #], qryGetBasePerContainer.[Freight tender date]
HAVING (((Max(tblOcean.EffectiveDate))<[qryGetBasePerContainer]![Freight
tender date]));