Reputation: 23
My code fails with the above error when it reaches the 4th line of the following code. I've used this same format earlier in my program and it works just fine. If more code is needed to resolve the error I'd be happy to post. Thanks.
With rsTIP19
.ActiveConnection = cnTIP
.Open "exec usp_Service_Data_Query_QA"
ThisWorkbook.Sheets("Service_Data").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).CopyFromRecordset rsTIP19
.Close
End With
Upvotes: 0
Views: 586
Reputation:
What is the purpose of exec? You should test to for .BOF
or .EOF
.
With rsTIP19
.ActiveConnection = cnTIP
.Open "usp_Service_Data_Query_QA"
If Not .BOF or .EOF then
ThisWorkbook.Sheets("Service_Data").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).CopyFromRecordset rsTIP19
End If
.Close
End With
Upvotes: 1