Solved

Copy some records in a new database

Posted on 1999-01-29
4
140 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 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

719 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