Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Correct format for Docmd.Transferspreadsheet 1

Status
Not open for further replies.

WeeDram

Technical User
Jun 16, 2006
13
0
0
GB
I've created the following function, but it is falling over at the Docmd.TransferSpreadsheet line - I'm just not sure how to include the recordset in the command.
Can someone advise where I'm going wrong?

Code:

Function fcast_output()

Dim db As Database
Dim rs As Recordset

Set db = CurrentDb

Set rs = db.OpenRecordset("Select * from Forecast_Template Where Forecast_Template.country_description = 'UK';")

DoCmd.TransferSpreadsheet acExport, 8, rs, "G:\MyFolder\Forecast_Template_Test", False, "Data"

End Function

Thanks

Peter
 
You can't export a RecordSet but a Query ...

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV - Many thanks, means I'll need to create a few queries to do what I want!

Peter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top