When I execute the following in Access 97 (checking whether the customer has a different site address from invoice address):
SELECT ServContrac.ServContrNo AS ContrNo, ServContrac.ICustCodeCon AS ICustNo, ServContrac.CustSiteNo AS Site, IIf(IsNull([CustSiteAdd]![CustomerCode]),[Customers]![CustomerName],[CustSiteAdd]![CustomerName]) AS CustName, IIf(IsNull([CustSiteAdd]![CustomerCode]),[Customers]![Zip-Code],[CustSiteAdd]![Zip^Code]) AS Zip, ZipStart([Zip]) AS Zip4 INTO tbl01temp
FROM (ServContrac LEFT JOIN CustSiteAdd ON (ServContrac.CustSiteNo = CustSiteAdd.[Site^No]) AND (ServContrac.ICustCodeCon = CustSiteAdd.CustomerCode)) LEFT JOIN Customers ON ServContrac.ICustCodeCon = Customers.CustomerCode;
The program leaves NULL in the two calculated fields (does not write the data from the "then" clause)where ever the "if" clause is true. HOWEVER,everything is fine when run as a SELECT query (identical except for INTO statement). This is a little like Newton watching the apple fall UP! Can anyone help?
Thanks in advance
Fred
SELECT ServContrac.ServContrNo AS ContrNo, ServContrac.ICustCodeCon AS ICustNo, ServContrac.CustSiteNo AS Site, IIf(IsNull([CustSiteAdd]![CustomerCode]),[Customers]![CustomerName],[CustSiteAdd]![CustomerName]) AS CustName, IIf(IsNull([CustSiteAdd]![CustomerCode]),[Customers]![Zip-Code],[CustSiteAdd]![Zip^Code]) AS Zip, ZipStart([Zip]) AS Zip4 INTO tbl01temp
FROM (ServContrac LEFT JOIN CustSiteAdd ON (ServContrac.CustSiteNo = CustSiteAdd.[Site^No]) AND (ServContrac.ICustCodeCon = CustSiteAdd.CustomerCode)) LEFT JOIN Customers ON ServContrac.ICustCodeCon = Customers.CustomerCode;
The program leaves NULL in the two calculated fields (does not write the data from the "then" clause)where ever the "if" clause is true. HOWEVER,everything is fine when run as a SELECT query (identical except for INTO statement). This is a little like Newton watching the apple fall UP! Can anyone help?
Thanks in advance
Fred