Here's my code
Function outliers()
'create outliers report
DoCmd.setwarnings False
DoCmd.RunSQL "SELECT Skills.Type, Employees.FirstOfKey, Sum(YTD.[ACD CALLS]) AS NCH, Sum([ACD AHT]*[ACD CALLS]) AS Total_AHT, Sum([ATT]*[ACD CALLS]) AS Total_ATT, Sum([ACW]*[ACD CALLS]) AS Total_ACW, Sum([HOLD]*[ACD CALLS]) AS Total_HOLD, YTD.DATE INTO tmp_Outliers FROM (YTD INNER JOIN Employees ON YTD.Key = Employees.FirstOfKey) INNER JOIN Skills ON YTD.[Split/Skill] = Skills.Skill GROUP BY Skills.Type, Employees.FirstOfKey, YTD.DATE HAVING (((YTD.DATE)=Date()-1));"
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<This is where the code stops and I get the overflow message>>>>>>>>>>>>>>
'ACW
DoCmd.RunSQL "SELECT tmp_Outliers.Type, tmp_Outliers.FirstOfKey, tmp_Outliers.NCH, [Total_AHT]/[NCH] AS AHT, [Total_ACW]/[NCH] AS ACW, [Total_ATT]/[NCH] AS ATT, [Total_HOLD]/[NCH] AS HOLD, tmp_Outliers.DATE, Employees.Site, 'Team ' & Employees_1.Last AS Supervisor INTO ACW FROM (tmp_Outliers INNER JOIN Employees ON tmp_Outliers.FirstOfKey = Employees.FirstOfKey) INNER JOIN Employees AS Employees_1 ON Employees.ReportsTo = Employees_1.AIN WHERE ((([Total_ACW]/[NCH])>90));"
'AHT
DoCmd.RunSQL "SELECT tmp_Outliers.Type, tmp_Outliers.FirstOfKey, tmp_Outliers.NCH, [Total_AHT]/[NCH] AS AHT, [Total_ACW]/[NCH] AS ACW, [Total_ATT]/[NCH] AS ATT, [Total_HOLD]/[NCH] AS HOLD, tmp_Outliers.DATE, Employees.Site, 'Team ' & Employees_1.Last AS Supervisor INTO AHT FROM (tmp_Outliers INNER JOIN Employees ON tmp_Outliers.FirstOfKey = Employees.FirstOfKey) INNER JOIN Employees AS Employees_1 ON Employees.ReportsTo = Employees_1.AIN WHERE ((([Total_AHT]/[NCH])>475));"
'ATT
DoCmd.RunSQL "SELECT tmp_Outliers.Type, tmp_Outliers.FirstOfKey, tmp_Outliers.NCH, [Total_AHT]/[NCH] AS AHT, [Total_ACW]/[NCH] AS ACW, [Total_ATT]/[NCH] AS ATT, [Total_HOLD]/[NCH] AS HOLD, tmp_Outliers.DATE, Employees.Site, 'Team ' & Employees_1.Last AS Supervisor INTO ATT FROM (tmp_Outliers INNER JOIN Employees ON tmp_Outliers.FirstOfKey = Employees.FirstOfKey) INNER JOIN Employees AS Employees_1 ON Employees.ReportsTo = Employees_1.AIN WHERE ((([Total_ATT]/[NCH])>350));"
'HOLD
DoCmd.RunSQL "SELECT tmp_Outliers.Type, tmp_Outliers.FirstOfKey, tmp_Outliers.NCH, [Total_AHT]/[NCH] AS AHT, [Total_ACW]/[NCH] AS ACW, [Total_ATT]/[NCH] AS ATT, [Total_HOLD]/[NCH] AS HOLD, tmp_Outliers.DATE, Employees.Site, 'Team ' & Employees_1.Last AS Supervisor INTO HOLD FROM (tmp_Outliers INNER JOIN Employees ON tmp_Outliers.FirstOfKey = Employees.FirstOfKey) INNER JOIN Employees AS Employees_1 ON Employees.ReportsTo = Employees_1.AIN WHERE ((([Total_HOLD]/[NCH])>120));"
MsgBox "Done"
DoCmd.setwarnings True
End Function
Thanks in a advance for the help
Function outliers()
'create outliers report
DoCmd.setwarnings False
DoCmd.RunSQL "SELECT Skills.Type, Employees.FirstOfKey, Sum(YTD.[ACD CALLS]) AS NCH, Sum([ACD AHT]*[ACD CALLS]) AS Total_AHT, Sum([ATT]*[ACD CALLS]) AS Total_ATT, Sum([ACW]*[ACD CALLS]) AS Total_ACW, Sum([HOLD]*[ACD CALLS]) AS Total_HOLD, YTD.DATE INTO tmp_Outliers FROM (YTD INNER JOIN Employees ON YTD.Key = Employees.FirstOfKey) INNER JOIN Skills ON YTD.[Split/Skill] = Skills.Skill GROUP BY Skills.Type, Employees.FirstOfKey, YTD.DATE HAVING (((YTD.DATE)=Date()-1));"
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<This is where the code stops and I get the overflow message>>>>>>>>>>>>>>
'ACW
DoCmd.RunSQL "SELECT tmp_Outliers.Type, tmp_Outliers.FirstOfKey, tmp_Outliers.NCH, [Total_AHT]/[NCH] AS AHT, [Total_ACW]/[NCH] AS ACW, [Total_ATT]/[NCH] AS ATT, [Total_HOLD]/[NCH] AS HOLD, tmp_Outliers.DATE, Employees.Site, 'Team ' & Employees_1.Last AS Supervisor INTO ACW FROM (tmp_Outliers INNER JOIN Employees ON tmp_Outliers.FirstOfKey = Employees.FirstOfKey) INNER JOIN Employees AS Employees_1 ON Employees.ReportsTo = Employees_1.AIN WHERE ((([Total_ACW]/[NCH])>90));"
'AHT
DoCmd.RunSQL "SELECT tmp_Outliers.Type, tmp_Outliers.FirstOfKey, tmp_Outliers.NCH, [Total_AHT]/[NCH] AS AHT, [Total_ACW]/[NCH] AS ACW, [Total_ATT]/[NCH] AS ATT, [Total_HOLD]/[NCH] AS HOLD, tmp_Outliers.DATE, Employees.Site, 'Team ' & Employees_1.Last AS Supervisor INTO AHT FROM (tmp_Outliers INNER JOIN Employees ON tmp_Outliers.FirstOfKey = Employees.FirstOfKey) INNER JOIN Employees AS Employees_1 ON Employees.ReportsTo = Employees_1.AIN WHERE ((([Total_AHT]/[NCH])>475));"
'ATT
DoCmd.RunSQL "SELECT tmp_Outliers.Type, tmp_Outliers.FirstOfKey, tmp_Outliers.NCH, [Total_AHT]/[NCH] AS AHT, [Total_ACW]/[NCH] AS ACW, [Total_ATT]/[NCH] AS ATT, [Total_HOLD]/[NCH] AS HOLD, tmp_Outliers.DATE, Employees.Site, 'Team ' & Employees_1.Last AS Supervisor INTO ATT FROM (tmp_Outliers INNER JOIN Employees ON tmp_Outliers.FirstOfKey = Employees.FirstOfKey) INNER JOIN Employees AS Employees_1 ON Employees.ReportsTo = Employees_1.AIN WHERE ((([Total_ATT]/[NCH])>350));"
'HOLD
DoCmd.RunSQL "SELECT tmp_Outliers.Type, tmp_Outliers.FirstOfKey, tmp_Outliers.NCH, [Total_AHT]/[NCH] AS AHT, [Total_ACW]/[NCH] AS ACW, [Total_ATT]/[NCH] AS ATT, [Total_HOLD]/[NCH] AS HOLD, tmp_Outliers.DATE, Employees.Site, 'Team ' & Employees_1.Last AS Supervisor INTO HOLD FROM (tmp_Outliers INNER JOIN Employees ON tmp_Outliers.FirstOfKey = Employees.FirstOfKey) INNER JOIN Employees AS Employees_1 ON Employees.ReportsTo = Employees_1.AIN WHERE ((([Total_HOLD]/[NCH])>120));"
MsgBox "Done"
DoCmd.setwarnings True
End Function
Thanks in a advance for the help