Hey everyone,
Access appears to be intermittedly rewriting one of my queries. I write the query one way and it works fine for like half a day (yielding the correct results), but then for no apparent reason, I'll open the query and it will be changed, yielding a completely different set of records. Perhaps I have made some mistake in my SQL (I used the Access query design window to create the query for the most part)? I hate to ask somebody to wade through all this SQL, but I would really appreciate the effort. The part Access is changing is in the WHERE part.
So here's is my original SQL:
SELECT DISTINCT Transformers.Manufacturer, Transformers.ManufacturerDesignID, Transformers.CommodityType, Transformers.[Unit Price], Transformers.[Load Loss], Transformers.[No Load Loss], Transformers.[Date Added], Transformers.Comments, Transformers.[Transformer Category], Transformers.[Primary Voltage], Transformers.[Secondary Voltage], Transformers.KVA, Transformers.Other, Transformers.[GPC Com Num], Transformers.[APC Com Num], Transformers.[MPC Com Num], Transformers.[Gulf Com Num], Transformers.[SAV Com Num], Transformers.[SIIS Com Num], Transformers.[A Factor], Transformers.[B Factor], Transformers.TOC, CorrespondingValues.[Corresponding TOC], Transformers.[Hard Dollar TOC], Transformers.[Distance from Origin], CorrespondingValues.[Lowest Distance from Origin], [Distance from Origin]-[Lowest Distance from Origin] AS Difference, [TOC]-[Corresponding TOC] AS TOCDiff, [Unit Price]-[Corresponding Unit Price] AS PriceDiff, IIf(([Unit Price]-[Corresponding Unit Price])<>0,([TOC]-[Corresponding TOC])/([Unit Price]-[Corresponding Unit Price]),0) AS Ratio
FROM CorrespondingValues INNER JOIN Transformers ON CorrespondingValues.CommodityType = Transformers.CommodityType
WHERE (((Transformers.[Transformer Category])=[Forms]![Evaluate]![TransTypeQuery]) AND (([Unit Price]-[Corresponding Unit Price])<=0) AND ((IIf(([Unit Price]-[Corresponding Unit Price])<>0,([TOC]-[Corresponding TOC])/([Unit Price]-[Corresponding Unit Price]),0))>=-1.02))
ORDER BY [Distance from Origin]-[Lowest Distance from Origin];
And here is what Access appears to be changing it to:
SELECT DISTINCT Transformers.Manufacturer, Transformers.ManufacturerDesignID, Transformers.CommodityType, Transformers.[Unit Price], Transformers.[Load Loss], Transformers.[No Load Loss], Transformers.[Date Added], Transformers.Comments, Transformers.[Transformer Category], Transformers.[Primary Voltage], Transformers.[Secondary Voltage], Transformers.KVA, Transformers.Other, Transformers.[GPC Com Num], Transformers.[APC Com Num], Transformers.[MPC Com Num], Transformers.[Gulf Com Num], Transformers.[SAV Com Num], Transformers.[SIIS Com Num], Transformers.[A Factor], Transformers.[B Factor], Transformers.TOC, CorrespondingValues.[Corresponding TOC], Transformers.[Hard Dollar TOC], Transformers.[Distance from Origin], CorrespondingValues.[Lowest Distance from Origin], [Distance from Origin]-[Lowest Distance from Origin] AS Difference, [TOC]-[Corresponding TOC] AS TOCDiff, [Unit Price]-[Corresponding Unit Price] AS PriceDiff, IIf(([Unit Price]-[Corresponding Unit Price])<>0,([TOC]-[Corresponding TOC])/([Unit Price]-[Corresponding Unit Price]),0) AS Ratio
FROM CorrespondingValues INNER JOIN Transformers ON CorrespondingValues.CommodityType = Transformers.CommodityType
WHERE (((Transformers.[Transformer Category])=[Forms]![Evaluate]![TransTypeQuery]) AND (([Unit Price]-[Unit Price])<=0) AND ((IIf(([Unit Price]-[Unit Price])<>0,([TOC]-[TOC])/([Unit Price]-[Unit Price]),0))>=-1.02))
ORDER BY [Distance from Origin]-[Lowest Distance from Origin];
Anybody have any ideas?
Thanks in advance,
Collen
Access appears to be intermittedly rewriting one of my queries. I write the query one way and it works fine for like half a day (yielding the correct results), but then for no apparent reason, I'll open the query and it will be changed, yielding a completely different set of records. Perhaps I have made some mistake in my SQL (I used the Access query design window to create the query for the most part)? I hate to ask somebody to wade through all this SQL, but I would really appreciate the effort. The part Access is changing is in the WHERE part.
So here's is my original SQL:
SELECT DISTINCT Transformers.Manufacturer, Transformers.ManufacturerDesignID, Transformers.CommodityType, Transformers.[Unit Price], Transformers.[Load Loss], Transformers.[No Load Loss], Transformers.[Date Added], Transformers.Comments, Transformers.[Transformer Category], Transformers.[Primary Voltage], Transformers.[Secondary Voltage], Transformers.KVA, Transformers.Other, Transformers.[GPC Com Num], Transformers.[APC Com Num], Transformers.[MPC Com Num], Transformers.[Gulf Com Num], Transformers.[SAV Com Num], Transformers.[SIIS Com Num], Transformers.[A Factor], Transformers.[B Factor], Transformers.TOC, CorrespondingValues.[Corresponding TOC], Transformers.[Hard Dollar TOC], Transformers.[Distance from Origin], CorrespondingValues.[Lowest Distance from Origin], [Distance from Origin]-[Lowest Distance from Origin] AS Difference, [TOC]-[Corresponding TOC] AS TOCDiff, [Unit Price]-[Corresponding Unit Price] AS PriceDiff, IIf(([Unit Price]-[Corresponding Unit Price])<>0,([TOC]-[Corresponding TOC])/([Unit Price]-[Corresponding Unit Price]),0) AS Ratio
FROM CorrespondingValues INNER JOIN Transformers ON CorrespondingValues.CommodityType = Transformers.CommodityType
WHERE (((Transformers.[Transformer Category])=[Forms]![Evaluate]![TransTypeQuery]) AND (([Unit Price]-[Corresponding Unit Price])<=0) AND ((IIf(([Unit Price]-[Corresponding Unit Price])<>0,([TOC]-[Corresponding TOC])/([Unit Price]-[Corresponding Unit Price]),0))>=-1.02))
ORDER BY [Distance from Origin]-[Lowest Distance from Origin];
And here is what Access appears to be changing it to:
SELECT DISTINCT Transformers.Manufacturer, Transformers.ManufacturerDesignID, Transformers.CommodityType, Transformers.[Unit Price], Transformers.[Load Loss], Transformers.[No Load Loss], Transformers.[Date Added], Transformers.Comments, Transformers.[Transformer Category], Transformers.[Primary Voltage], Transformers.[Secondary Voltage], Transformers.KVA, Transformers.Other, Transformers.[GPC Com Num], Transformers.[APC Com Num], Transformers.[MPC Com Num], Transformers.[Gulf Com Num], Transformers.[SAV Com Num], Transformers.[SIIS Com Num], Transformers.[A Factor], Transformers.[B Factor], Transformers.TOC, CorrespondingValues.[Corresponding TOC], Transformers.[Hard Dollar TOC], Transformers.[Distance from Origin], CorrespondingValues.[Lowest Distance from Origin], [Distance from Origin]-[Lowest Distance from Origin] AS Difference, [TOC]-[Corresponding TOC] AS TOCDiff, [Unit Price]-[Corresponding Unit Price] AS PriceDiff, IIf(([Unit Price]-[Corresponding Unit Price])<>0,([TOC]-[Corresponding TOC])/([Unit Price]-[Corresponding Unit Price]),0) AS Ratio
FROM CorrespondingValues INNER JOIN Transformers ON CorrespondingValues.CommodityType = Transformers.CommodityType
WHERE (((Transformers.[Transformer Category])=[Forms]![Evaluate]![TransTypeQuery]) AND (([Unit Price]-[Unit Price])<=0) AND ((IIf(([Unit Price]-[Unit Price])<>0,([TOC]-[TOC])/([Unit Price]-[Unit Price]),0))>=-1.02))
ORDER BY [Distance from Origin]-[Lowest Distance from Origin];
Anybody have any ideas?
Thanks in advance,
Collen