Append a recordset

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In vb, is there an easy way to create a temporary recordset with the same
field structure as an exsisting table and then append the entire recordset to
the table? Is there a command to do this, or do I need to create a custom
handler to iterate through each record and run some "INSERT INTO" for each
record?
 
In vb, is there an easy way to create a temporary recordset with the same
field structure as an exsisting table and then append the entire recordset to
the table?

To create a temporary recordset, I always create a temporary table using the
TransferDatabase method (where you can import the data or just keep the
structure), then base a recordset off the temporary table.

To update the existing table, I open it as a recordset, then use:

TempRS.Movefirst
Do Until TempRS.EOF
MyRS.Addnew
For Each fld in MyRS.Fields
MyRS(fld.Name) = TempRS(fld.Name)
Next fld
TempRS.Movenext
Loop

Where 'TempRS', 'MyRS' declared as DAO.Recordset, and 'fld' as Dao.Field

I'm not sure if that was what you needed, but if it was, I hope it helps.

Nick
 
Back
Top