Hello everybody
In MS Access 2013 I have this sql that works well.
To run querys in a Form I have a txtmonth to enter year_month for example 2017_03. I also have I command buttonSELECT Format([dat],("yyyy""_""mm")) AS Month, tbltask.taskname AS TaskFROM tbltaskINNER JOIN tblMOD ON tbltarea.task_id = tblMOD.task_id
GROUP BY Format([dat],("yyyy""_""mm")), tbltask.taskname
HAVING (((Format([dat],("yyyy""_""mm")))=[Forms]![frm_Main]![txtmonth]));
to export the query to excel. My code is:
Sub cmdexportmod_qry_month()
If DCount("*", "mod_qry_month") <> 0 Then
DoCmd.OutputTo acOutputQuery, "mod_qry_month", acFormatXLSX, "D:\ASSUKKAR\Cons_mod_month\mod_qry_month.xlsx ", False
MsgBox "La Consulta se exportó a Excel"
Else
MsgBox "The already exported to Excel"
DoCmd.Close acQuery, "mod_qry_month"
End If
End SubI need the name of the exported query be concatenated with values I enter in "txtmonth". For example If I type in "txtmonth" 2017_03 the query exported name will be: 2017_03_mod_qry_month.
if I enter 2017_02 the query name will be 2017_02_mod_qry_month and so on.
Please help
Many thanks