I got it. Thanks a lot!
Kevin-The filter has to be embedded in the query. There's no way to include a dynamic filter in TransferSpreadSheet like there is in OpenForm or OpenReport. Open the query in a QueryDef object, modify the SQL, close the QueryDef (which will save it), then run your TransferSpreadSheet.John Viescas, AuthorMicrosoft Access 2010 Inside OutMicrosoft Access 2007 Inside OutMicrosoft Access 2003 Inside OutBuilding Microsoft Access ApplicationsSQL Queries for Mere Mortals(Paris, France)
On Feb 1, 2016, at 2:16 PM, 'firstname.lastname@example.org' email@example.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:John,I got it. It works great. Then I encounter another problem. I want filter spacific records like: "GroupBookingID=" & Me.BroupBookingID, where should I put this filter in the code below? Thanks.DoCmd.TransferSpreadsheet transfertype:=acExport, _
TableName:="Query1", fileName:="C:\Users\Administrator\Desktop\Myfile.xlsx"Best Regards,Kevin
Kevin-Write a query that extracts the info you want, then export the query to Excel.John Viescas, AuthorMicrosoft Access 2010 Inside OutMicrosoft Access 2007 Inside OutMicrosoft Access 2003 Inside OutBuilding Microsoft Access ApplicationsSQL Queries for Mere Mortals(Paris, France)
Posted by: "firstname.lastname@example.org" <email@example.com>
|Reply via web post||•||Reply to sender||•||Reply to group||•||Start a New Topic||•||Messages in this topic (5)|