I have a form that allows me to filter data for the user. I would like to be able to export that filtered data to Excel. I found a solution on here by vbaInet, but I don't think I'm writing the code correctly. Here is what I have:
strSQL = "SELECT * From [KSA_by_Media Query] WHERE ([ID]=" & Me![ID] & ");"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, strSQL, pad & "Test.xls", True
Most likely the problem is that I have hardly any idea what any of that means, and I'm just copying. I've tried KSA_by_Media, which is a table rather than a query. I have also tried changing ID to the key field in my table. I also am unsure if these two lines are supposed to be combined as they are. Basically, I'm clueless, but I would appreciate any help.
Thanks
strSQL = "SELECT * From [KSA_by_Media Query] WHERE ([ID]=" & Me![ID] & ");"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, strSQL, pad & "Test.xls", True
Most likely the problem is that I have hardly any idea what any of that means, and I'm just copying. I've tried KSA_by_Media, which is a table rather than a query. I have also tried changing ID to the key field in my table. I also am unsure if these two lines are supposed to be combined as they are. Basically, I'm clueless, but I would appreciate any help.
Thanks