runtime error when copyfromrecordset
when i try to use CopyFromRecordset to export data to excel ,
it generate runtime error '-2147467259(800004005)':
Automation Error
Unspecified Error
but when I add conditions in sql as red marked to smaller the sql result to several records , it works well.
what caused this and how can i solve it ?? thanks!
Set ConnSet.ActiveConnection = Conn
ConnQuery = "SELECT product,facility FROM DWH_FAB300.DWH_PRODUCT where product='111111' "
Set ConnSet = Conn.Execute(ConnQuery, RowsAffected, CommandTypeEnum.adCmdText)
Call Sheets("product").Range("A1").CopyFromRecordset(Co nnSet)
|