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
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