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, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
On Feb 1, 2016, at 2:16 PM, 'email@example.com' firstname.lastname@example.org [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
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, _
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: John Viescas <email@example.com>
|Reply via web post||•||Reply to sender||•||Reply to group||•||Start a New Topic||•||Messages in this topic (4)|