• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 143
  • Last Modified:

Copy some records in a new database

Hi,
I would like to know how to copy some records from a table
to a new table (same structure) in a new database name.
Example
datebase name = toto.mdb
table = telephone_list

and I want to copy some record from TABLE "telephone_list" to a new TABLE name "telephone" in a new database name
"telephone.mdb"

Thank
0
woaini
Asked:
woaini
1 Solution
 
dudemannCommented:
You could probably export that table to a new .mdb.  Also, if you wanted to export just a few records, then you could probably do a select that gets the desired recs and export the resultset to a new .mdb.

Good luck!
0
 
MikeP090797Commented:
Just like dudeman said, create the new table, open it as a recordset. open the source table as a recordset as well, and transfer the records using simple .AddNew calls to the new recordset
0
 
sbmcCommented:
dim srcDB as database,trgDB as database
dim srcRS as recordset,trgRS as recordset
set srcDB=opendatabase("Source")
set trgDB=opendatabase("Target")
set srcRS=srcDB.openrecordset("Phone")
set trgRS=trgDB.openrecordset("Phone")
srcRS.Movefirst
do until srcRS.EOF
    trgRS.Addnew
    for i =1 to srcRS.fields.count - 1
       trgRS.fields(i)=srcRS.fields(i)
    next i
    trgRS.Update
    srcRS.Movenext
loop


This will copy all records from source to target
0
 
woainiAuthor Commented:
Thank a lot !
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now