I have a small problem. I have a VBA macro that creates a table. It works. But Call set data type "short text" and a need a number for column FB_average, Cil_FB and Plneni_FB. Does anyone please have a solution tip?
Call generuj_t_vystup("t_prod_work_time_fb.Skill,t_prod_work_time_fb.Skill_KM,t_prod_work_time_fb.Locality,t_prod_work_time_fb.Team,t_prod_work_time_fb.Spv_name,t_prod_work_time_fb.Agent_name,t_prod_work_time_fb.Agent_login,t_prod_work_time_fb.Rok,t_prod_work_time_fb.Kvartal,t_prod_work_time_fb.Měsíc,t_prod_work_time_fb.Tyden,t_prod_work_time_fb.Event_date", "t_vystup_fb_denni_agent")
Public Function generuj_t_vystup(hlavicka As String, vystupni_tabulka As String)
SQL = "Select "
SQL = SQL & hlavicka & ", "
SQL = SQL & "Nz(SUM([Feedback_summary])) AS FB_summary,"
SQL = SQL & " Nz(SUM([Feedback_count])) AS FB_count,"
SQL = SQL & " Nz(SUM([Feedback_summary])/SUM([Feedback_count])) AS FB_average,"
SQL = SQL & " Nz(SUM([Feedback_summary])/SUM([Feedback_count])) AS Cil_FB,"
SQL = SQL & " Nz(SUM([Feedback_summary])/SUM([Feedback_count])) AS Plneni_FB"
SQL = SQL & " INTO "
SQL = SQL & vystupni_tabulka
SQL = SQL & " FROM t_prod_work_time_fb "
SQL = SQL & " GROUP BY "
SQL = SQL & hlavicka
spustsql SQL
End Function
Sub spustsql(SQL As Variant)
On Error GoTo chyba
DoCmd.RunSQL SQL
Exit Sub
Thanks a lot.
CDbl(Nz(SUM([Feedback_summary])/SUM([Feedback_count])) AS FB_average,
to force a detection of Double type. – Vincent G