OldManRiver
Registered User.
- Local time
- Yesterday, 20:44
- Joined
- Jan 29, 2009
- Messages
- 49
All,
I'm trying to run an export from Access to Excel, but the transferdatabase method does not work well with the query I have:
Seems all the method is capable of is a straight table export.
Been screwing with this code:
as you can see from all the commented out lines.
So my question:
Is there a way to make it work with a query that includes a "WHERE" filtering statement?
or
Do I have to run the query as recordset, save to a temp table and run the transferdatabase on the new temp table?
Thanks!
OMR
I'm trying to run an export from Access to Excel, but the transferdatabase method does not work well with the query I have:
Code:
WHRstr = "WHERE ([tim_wdt] >= #" & FMTval & "#) ORDER By [tim_wdt] desc;"
SQLstr = "SELECT * FROM qryMARTIN " & WHRstr
Been screwing with this code:
Code:
DoCmd.SetWarnings False
' DoCmd.RunSQL SQLstr
' DoCmd.TransferDatabase acExport, acSpreadsheetTypeExcel9, RSs, outXLFile
DoCmd.TransferSpreadsheet _
TransferType:=acExport, _
SpreadsheetType:=acSpreadsheetTypeExcel9, _
Source:=SQLstr, _
FileName:=outXLFile
' ObjectType:=acQuery, _
' FileName:=outXLFile, _
' HasFieldNames:=True
DoCmd.SetWarnings True
So my question:
Is there a way to make it work with a query that includes a "WHERE" filtering statement?
or
Do I have to run the query as recordset, save to a temp table and run the transferdatabase on the new temp table?
Thanks!
OMR