gwunta1907
Registered User.
- Local time
- Tomorrow, 03:03
- Joined
- Jan 11, 2007
- Messages
- 26
Hi guys,
I have a report I would like to export to excel - well I want to actually be able to export the data that is in the report. After some searching on the forums I found what I thought was the solution but it throwing an error. The code is listed below
The error is getting picked up at the Set rst = CurrentDb.OpenRecordset("qry_DailyTransReport") line and the error message is "Too few parameters. Expected 1."
Any clues as to what I have done wrong here?
Thanks in advance
I have a report I would like to export to excel - well I want to actually be able to export the data that is in the report. After some searching on the forums I found what I thought was the solution but it throwing an error. The code is listed below
Code:
Dim objXL As Object
Dim xlWB As Object
Dim xlWS As Object
Dim rst As DAO.Recordset
Set objXL = CreateObject("Excel.Application")
Set xlWB = objXL.Workbooks.Open("C:\temp\excelfile1.xls")
Set xlWS = xlWB.Worksheets("Sheet1")
Set rst = CurrentDb.OpenRecordset("qry_DailyTransReport")
xlWS.Range("A1").CopyFromRecordset rst
xlWB.Save
rst.Close
Set rst = Nothing
The error is getting picked up at the Set rst = CurrentDb.OpenRecordset("qry_DailyTransReport") line and the error message is "Too few parameters. Expected 1."
Any clues as to what I have done wrong here?
Thanks in advance