Results 1 to 5 of 5

Thread: copying data from table one to table two

  1. #1

    Thread Starter
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    copying data from table one to table two

    There are two tables with the same fields say 'firstname' and 'secondname'.

    How do I copy all the records from the first table(tableone.mdb) to the second table(tabletwo.mdb) which satisfy the condition that the second name should be 'smith'????

  2. #2
    Addicted Member
    Join Date
    Jan 2002
    Location
    Glasgow, Scotland
    Posts
    202

    Re: copying data from table one to table two

    use an append query.

    if you are using access this is relatively simple using the query builder. have a quick look in the help section

    if you want to use SQL then:

    Code:
    INSERT INTO [Table2] ( [Field 1], Field2)
    SELECT Table1.[FIeld 1], Table1.Field2
    FROM Table1
    WHERE Table1.Surname = "Smith";
    if you fail to plan, you plan to fail

  3. #3

    Thread Starter
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: copying data from table one to table two

    thankx a ton, i'll try that today by the way i am using VB as frontend and access as backend....
    Last edited by Siddharth Rout; Mar 24th, 2005 at 07:00 AM.

  4. #4
    Addicted Member
    Join Date
    Jan 2002
    Location
    Glasgow, Scotland
    Posts
    202

    Re: copying data from table one to table two

    yes it can be used in vb.

    you need to declare and set the database object to use it.

    Code:
    Dim dbs as Database
    
    set dbs = "c:\location of database"
    
    dbs.Execute "COPY SQL STATEMENT HERE"
    if you fail to plan, you plan to fail

  5. #5

    Thread Starter
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: copying data from table one to table two

    Sorry was out of town

    will try this code today

    appreciate your help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width