Wrong results in imbedded query

Jddjr

New Member
Joined
May 4, 2018
Messages
1
I have a query in MSAccess. The results are correct there. I imbed the query in Excel and the results are different. I am using Access and Excel version 10 so I cant use other sources I have to link through the access button as the other way only sees .mdb.
Here is the SQL. The OutPut_Matl.Group field is the only one incorrect.


SELECT First_of_year.FirstOfYear, First_of_year.FirstOfMonth, First_of_year.Division, First_of_year.Order, First_of_year.[Operation #] AS Operation, OutPut_Matl.Description AS Classification, OutPut_Matl.Group, OutPut_Matl.tYPE, OutPut_Matl.SumOfCountOfClassification AS Cnt, OutPut_Matl.Cost1 AS Matl, IIf([Count_of_materials]![CountOfDescription] Is Not Null,[Total_Oper_Contr]![oper_cst]/[Count_of_materials]![CountOfDescription],[Total_Oper_Contr]![oper_cst]) AS Contr, IIf([Count_of_materials]![CountOfDescription] Is Not Null,[Total_Traffic]![Traffic]/[Count_of_materials]![CountOfDescription],[Total_Traffic]![Traffic]) AS Traf_cst, IIf([Count_of_materials]![CountOfDescription] Is Not Null,[Total_OS]![O-Serv]/[Count_of_materials]![CountOfDescription],[Total_OS]![O-Serv]) AS [O-Serv], IIf([Count_of_materials]![CountOfDescription] Is Not Null,[Total_surch]![Surch]/[Count_of_materials]![CountOfDescription],[Total_surch]![Surch]) AS Surch, IIf([Count_of_materials]![CountOfDescription] Is Not Null,[Total_oper_lbr]![Labor]/[Count_of_materials]![CountOfDescription],[Total_oper_lbr]![Labor]) AS Lbr_cst, IIf([Count_of_materials]![CountOfDescription] Is Not Null,[Operation_Actual_Hours]![ACTUAL_WORK]/[Count_of_materials]![CountOfDescription],[Operation_Actual_Hours]![ACTUAL_WORK]) AS Lbr_hrs
FROM (((((((First_of_year LEFT JOIN OutPut_Matl ON (First_of_year.[Operation #] = OutPut_Matl.[Operation #]) AND (First_of_year.Order = OutPut_Matl.Order)) LEFT JOIN Count_of_materials ON (OutPut_Matl.[Operation #] = Count_of_materials.[Operation #]) AND (OutPut_Matl.Order = Count_of_materials.Order)) LEFT JOIN Operation_Actual_Hours ON (First_of_year.[Operation #] = Operation_Actual_Hours.[Operation #]) AND (First_of_year.Order = Operation_Actual_Hours.Order)) LEFT JOIN Total_Oper_Contr ON (First_of_year.[Operation #] = Total_Oper_Contr.[Operation #]) AND (First_of_year.Order = Total_Oper_Contr.Order)) LEFT JOIN Total_Traffic ON (First_of_year.[Operation #] = Total_Traffic.[Operation #]) AND (First_of_year.Order = Total_Traffic.Order)) LEFT JOIN Total_OS ON (First_of_year.[Operation #] = Total_OS.[Operation #]) AND (First_of_year.Order = Total_OS.Order)) LEFT JOIN Total_surch ON (First_of_year.[Operation #] = Total_surch.[Operation #]) AND (First_of_year.Order = Total_surch.Order)) LEFT JOIN Total_oper_lbr ON (First_of_year.[Operation #] = Total_oper_lbr.[Operation #]) AND (First_of_year.Order = Total_oper_lbr.Order);
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
so you are using a query on an internal table, gets 1 result,
then the same query on an external excel file and get another result?

if the data is the same in both ,you WILL get the same results.
 
Upvote 0

Forum statistics

Threads
1,214,982
Messages
6,122,580
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top