Solved

Copy some records in a new database

Posted on 1999-01-29
4
137 Views
Last Modified: 2010-05-03
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
Comment
Question by:woaini
4 Comments
 

Expert Comment

by:dudemann
ID: 1471195
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
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1471196
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
 
LVL 2

Accepted Solution

by:
sbmc earned 50 total points
ID: 1471197
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
 

Author Comment

by:woaini
ID: 1471198
Thank a lot !
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question