Hello everyone! I want to export ms access qry to excel
In an MS Access Form have 3 txtboxes to export querys to Excel
txtboxd. User picks a day from ms access calendar as dd/mm/yyyy
txtboxw. User enters week number as ww, yyyy
txtboxm. User enters month, year (mmm, year)
If user picks in textboxd 23_03_2017 I have a cmb with code to export query to Excel.
However, exported query name is Me.txtcos_dy _qcos_dy but,
I need such file name as the date user picks, for example 23_03_2017_qcos_dy.
I have been googling and testing many ways with no success.
Please, could you help me with that? Thx a lot!
In an MS Access Form have 3 txtboxes to export querys to Excel
txtboxd. User picks a day from ms access calendar as dd/mm/yyyy
txtboxw. User enters week number as ww, yyyy
txtboxm. User enters month, year (mmm, year)
If user picks in textboxd 23_03_2017 I have a cmb with code to export query to Excel.
However, exported query name is Me.txtcos_dy _qcos_dy but,
I need such file name as the date user picks, for example 23_03_2017_qcos_dy.
I have been googling and testing many ways with no success.
Please, could you help me with that? Thx a lot!
Private Sub cmb_cos_dy_Click()Dim filename1 As String
Dim filename2 As String
If DCount("*", "qcos_dy") <> 0 Then
filename1 = "D:\Me.txtcos_dy " & "_" & "qcos_dy" & ".xlsx"
Debug.Print filename2
DoCmd.OutputTo acOutputQuery, "qcos_dy", acFormatXLSX, filename1, False
MsgBox "Query already exported to Excel"
Else
MsgBox "This day has no records"
DoCmd.Close acQuery, "qcos_dy"
End If
End Sub