copyFromRecordset error Excel macro
While pulling data from MS SQL and dumping it to a worksheet using the following code. It has worked until the ActnPlanDesc field (description field) exceeds 900 char. My question is is there indeed a 900 char limit with ADO or do I have something missing in my SQL statment?
zConnectionString = _
"Provider=SQLOLEDB.1;Password=xxxxxx;Persist Security Info=True;" + _
"User ID=xxxxxx;Initial Catalog=xxxxxxxx;Data Source=xxxxxxxx;"
zSQL = "select DISTINCT ProcBusCycle,CntrlName,ActnPlanName,ActnPlanDocTit le,ActnPlanDesc,ActnPlanCriticality,ActnPlanSteps, ActnPlanStatus,ActnPlanDueDate,ActnPlanResponse,Cn trlDesc,CntrlFrequency,CntrlType2 from ObjSrchTypViewActPlnProcRskMatCntrls Where OrgUnitName LIKE '%Intel%'AND ProcBusCycle NOT LIKE ('%Information%')"
Set zConnection = New ADODB.Connection
zConnection.ConnectionString = zConnectionString
zConnection.Open
Set zRecordset = New ADODB.Recordset
zRecordset.CursorLocation = CursorLocationEnum.adUseClient
zRecordset.CursorType = CursorTypeEnum.adOpenStatic
zRecordset.LockType = LockTypeEnum.adLockBatchOptimistic
Call zRecordset.Open(zSQL, zConnection, , , CommandTypeEnum.adCmdText)
[u]Call Sheet4.Range("A2").CopyFromRecordset(zRecordset)</u>
Set zRecordset.ActiveConnection = Nothing
Set zConnection = Nothing
|