Can anyone help me locate where the error is in the SQL Statement
i'm usign a dynamic name for the table in the select where the table is = "tsktsrhst" & strFullTableName where strFullTableName represents a date....exaple would be "tsktsrhst123114" so my first select would be "tsktsrhst123114.tsr"
thanks
tuktuk
Code:
strSql = "INSERT INTO tbl_Phone_Stats_by_Day (tsr, call_date, SumOftot_calls, SumOftime_connect, SumOftime_paused, SumOftime_waiting, SumOftime_deassigned, SumOflogon_time, logoff_time, SumOftime_acw ) " & vbCrLf & _
"SELECT " & "tsktsrhst" & strFullTableName & ".tsr," & "tsktsrhst" & strFullTableName & ".call_date,Sum(" & "tsktsrhst" & strFullTableName & ".tot_calls) AS SumOftot_calls, Sum(" & "tsktsrhst" & strFullTableName & ".time_connect) AS SumOftime_connect, Sum(" & "tsktsrhst" & strFullTableName & ".time_paused) AS SumOftime_paused, Sum(" & "tsktsrhst" & strFullTableName & ".time_waiting) AS SumOftime_waiting, Sum(" & "tsktsrhst" & strFullTableName & ".time_deassigned) AS SumOftime_deassigned, Sum(" & "tsktsrhst" & strFullTableName & ".logon_time) AS SumOflogon_time," & "tsktsrhst" & strFullTableName & ".logoff_time, Sum( " & "tsktsrhst" & strFullTableName & ".time_acw) AS SumOftime_acw" & vbCrLf & _
"FROM " & "tsktsrhst" & strFullTableName & vbCrLf & _
"GROUP BY " & "tsktsrhst" & strFullTableName & ".tsr""," & "tsktsrhst" & strFullTableName & ".call_date""," & "tsktsrhst" & strFullTableName & ".logoff_time;"
i'm usign a dynamic name for the table in the select where the table is = "tsktsrhst" & strFullTableName where strFullTableName represents a date....exaple would be "tsktsrhst123114" so my first select would be "tsktsrhst123114.tsr"
thanks
tuktuk