Andrew Map
Andrew Map

Reputation: 31

Recordset does not return all data VBA

I am having some problem trying to extract some data from a recordset, the vba code is something as simple as this :

cnt.Open stDB

Query = "SELECT TriggerDescription,"
Query = Query & " FROM Research_Control"
Query = Query & " WHERE (((Research_Control.Status) = 1))"
Query = Query & " ORDER BY Research_Control.Enterprise;"

rs.Open Query, cnt, adUseClient

    While Not rs.EOF

        Sheets("Research_Review").Cells(lineResearch + line, colResearch) = rs.Fields(0)

        line = line + 1
        rs.MoveNext

    Wend

rs.Close

cnt.Close 

The "TriggerDescription" is as large as 500 characteres and when I copy this value to a cell in excel it only appears until 300 characteres

So my question is : How can I extract all data from a recordset ?

PS: I have already tried changing the timeout with " cnt.CommandTimeout = 60 " but it does not work either

EDIT : In the Table Design the field "TriggerDescription" is a ntext DataType FYI.

Upvotes: 0

Views: 1482

Answers (1)

Andrew Map
Andrew Map

Reputation: 31

@A.S.H has given the answer, using CopyFromRecordset I can copy all data to the cell

Sheets("Test").Range("test").CopyFromRecordset rs

Upvotes: 1

Related Questions