ADO recordset without a connection object

bretto

Registered User.
Local time
Today, 14:43
Joined
Jun 25, 2003
Messages
29
Hi,

I vaguely remember reading somewhere that you can use ADO to create a "connectionless recordset" in code. I have come across several situations recently where this would be handy but have been unable to get it to work with trial an error or found an example. What I’m basically after is an array that can be manipulated like a recordset so movefirst, EOF etc, etc.

Something like this;

Dim myset As New Recordset


myset.Fields.Append "Field1", adBSTR, 10
myset.Fields.Append "Field2", adBSTR, 10
myset.Fields.Append "Field3", adBSTR, 10

myset.AddNew
myset![Field1] = "Testdata1"
myset![Field2] = "Testdata2"
myset![Field3] = "Testdata3"
myset.Update

myset.movefirst

Any idea's on this would be much appreciated!!

Bretto
 
What I’m basically after is an array that can be manipulated like a recordset
Have you looked at the GetRows method for recordsets?
 
Code:
On Error GoTo ErrorHandler
    Dim myset As ADODB.Recordset

        Set myset= New ADODB.Recordset
        
        With myset
            .Fields.Append "Field1", adBSTR, 10
            .Fields.Append "Field2", adBSTR, 10
            .Fields.Append "Field3", adBSTR, 10
        End With
    
        'Set the Cursor to the Local Machine
        myset.CursorLocation = adUseClient
        'Open the recordset
        myset.Open

       With myset
            .AddNew
            ![Field1] = "Testdata1"
            ![Field2] = "Testdata2"
            ![Field3] = "Testdata3"
            .Update
       End With
 
Ah Ha!!! Cursor location

Cheers for that Travis, works a treat:)
 

Users who are viewing this thread

Back
Top Bottom