Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populating an ADODB.Recordset without DB 1

Status
Not open for further replies.

RicoCali

Programmer
Dec 7, 2002
80
US
I have a situation where I have to populate a recordset without getting a physical database involve. How would I go about doing this?
 
Use the .Fields.Append method to add the fields that you need. Then the .addnew method to add a record and set the field values, don't forget to update the recordset.
Code:
   Set rs = New ADODB.Recordset
   With rs
      .Fields.Append "Name", adVarChar, 120
      .Fields.Append "Address", adVarChar, 120
      ....
   End With

   With rs
      .AddNew
      .Fields(0).value = <Name>
      .Fields(1).value = <Address>
      ...
      .Update
  End with


zemp
 
One thing I forgot, asfter you have appended all your fields don't forget to open the recordset with the .Open command.

zemp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top