Solved

Copy some records in a new database

Posted on 1999-01-29
4
133 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thank a lot !
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now