Hello, I have a form with a list of names. When a specific name is selected from the list, a button is clicked and a query is run with the specific name as the criteria/filter.
I've written code to export these same query results to an Excel sheet, and I want the Excel file name saved with the name selected in the form.
Below is the code that I've written that doesn't work. Can someone tell me how to fix the code?
Thanks,
Code:
Dim strFileName As String
strFileName = SelectedItems(Me.lstName)
DoCmd.OutputTo acOutputQuery, "qryFocal_Sheet", acFormatXLS, "C:\JRS\Work\Equity\FY2015\" & strFileName & ".xls"
I've written code to export these same query results to an Excel sheet, and I want the Excel file name saved with the name selected in the form.
Below is the code that I've written that doesn't work. Can someone tell me how to fix the code?
Thanks,
Code:
Dim strFileName As String
strFileName = SelectedItems(Me.lstName)
DoCmd.OutputTo acOutputQuery, "qryFocal_Sheet", acFormatXLS, "C:\JRS\Work\Equity\FY2015\" & strFileName & ".xls"