All using 2016..I'm getting an error: msaccess can't save the output data to the file you've selected..
Code:
Private Sub Command9_Click()
Dim qryname As String
Dim theFilePath As String
qryname = "qryPrintrecord"
theFilePath = "C:\Documents and Settings\" & Environ("UserName") & "\Desktop\Output\"
theFilePath = theFilePath & reportname & "_" & Format(Date, "yyyy-mm-dd") & ".xls"
DoCmd.acOutputQuery, qryname, acfortmatXLS, theFilePath, True
MsgBox "Look on your desktop for the file in the output folder"
Can anyone assist pls