[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Copy some records in a new database

Posted on 1999-01-29
4
Medium Priority
?
142 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 200 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

650 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