I'm trying to copy a recordset to excel and format the spreadsheet from within Access. I have a problem because my recordset is a query which has fields whose parametes are controled from a form using combos. It gives me an error running the code that I have too few parameters, 5 expected.
Below is the start of the code.
Dim objXL As Excel.Application
Dim objWkb As Excel.Workbook
Dim ObjSht As Excel.Worksheet
Dim db As Database
Dim rs As Recordset
Dim Sheet1 As Excel.Worksheet
Dim Strsql As String
Dim PathAndFileName, WorksheetName, NameofNamedRange, iFirstRow
Set db = CurrentDb
Set objXL = New Excel.Application
Strsql = "A ESM by line number query"
Set rs = db.OpenRecordset(Strsql, dbOpenSnapshot)
With objXL
.Visible = True
Below is the start of the code.
Dim objXL As Excel.Application
Dim objWkb As Excel.Workbook
Dim ObjSht As Excel.Worksheet
Dim db As Database
Dim rs As Recordset
Dim Sheet1 As Excel.Worksheet
Dim Strsql As String
Dim PathAndFileName, WorksheetName, NameofNamedRange, iFirstRow
Set db = CurrentDb
Set objXL = New Excel.Application
Strsql = "A ESM by line number query"
Set rs = db.OpenRecordset(Strsql, dbOpenSnapshot)
With objXL
.Visible = True