I am trying to copy data from a query in my database to an excel sheet can anyone tell me why this is not working:
Set rst2 = CurrentDb.OpenRecordset("qryXXXX")
Do Until rst2.EOF
Set workSheet = appExcel.Worksheets("DataSheet" & i)
workSheet.Cells(rst2![CellRow], rst2![CellColumn]).Value = rst2![Value] '******
rst2.MoveNext
Loop
the code bombs on the line with the **** after it and it tells me error: "item not found in this collection"
Thanks ahead of time
Set rst2 = CurrentDb.OpenRecordset("qryXXXX")
Do Until rst2.EOF
Set workSheet = appExcel.Worksheets("DataSheet" & i)
workSheet.Cells(rst2![CellRow], rst2![CellColumn]).Value = rst2![Value] '******
rst2.MoveNext
Loop
the code bombs on the line with the **** after it and it tells me error: "item not found in this collection"
Thanks ahead of time