Hi,
I am exporting a record set to Excel within a loop and I am encountering the following error while defining that record set:
Error 3061 - Too few parameters - Expected 1
The line of code highlighted is:
The line in context is:
Please help as I am stuck on this for a long time!
Thanks in advance
I am exporting a record set to Excel within a loop and I am encountering the following error while defining that record set:
Error 3061 - Too few parameters - Expected 1
The line of code highlighted is:
Code:
Set SResults = db.OpenRecordset(sqlResult)
The line in context is:
Code:
For x = 1 To n
sqlResult = "SELECT [Annual Material Cost], [Total Logistics Cost], [Logistics Cost per Part], [Total Annual Cost per Part] FROM TACFinal_tbl WHERE [TAC ID] = '" & Me.TACID_tbx & "' AND [Scenario ID] = " & x
Set SResults = db.OpenRecordset(sqlResult)
objSht.Cells(4, y).CopyFromRecordset SResults
y = y + 4
Next
Please help as I am stuck on this for a long time!
Thanks in advance
