Results 1 to 2 of 2

Thread: Recordset.AddNew

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Posts
    13

    Exclamation

    if I use this method,does it mean every record I added to the recordset would be added to the table that it connects to?
    If I don't want that how to manage it?I only want to make the recordset a collection that store my searching result.And the records maybe from different tables and connections.
    Thanks.

  2. #2
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    So you want to make your own Recordset/Table that does not get stored anywhere?

    Here is an example of that. This RS is created and manipulated by my code, but not physically stored anywhere (except in memory, of course)

    Code:
        Dim rs As ADODB.Recordset
        Dim lngCounter As Long
        
        Set rs = New Recordset
        
        'create my temp recordset
        With rs
            .CursorLocation = adUseClient
            
            .Fields.Append "FirstName", adVarChar, 50
            .Fields.Append "LastName", adVarChar, 50
            
            .Open
            
            For lngCounter = 1 To 10
                'add my records, just some garbage values
                .AddNew
                .Fields("FirstName") = "Tom" & lngCounter
                .Fields("LastName") = "Clunie" & lngCounter
                .Update
            Next lngCounter
            
            'shows we have 10 recs
            MsgBox .RecordCount
            
            'show value of field
            MsgBox .Fields(0)
            
            'go to first record
            .MoveFirst
            
            'show that value
            MsgBox .Fields(0)
            
            
        End With

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width