Results 1 to 7 of 7

Thread: hi, all.. access db help..

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2007
    Posts
    839

    Question hi, all.. access db help..

    i have to table exactly different field...

    i wanted to copy the data from table1 with specific field to table2 with specific field also..

    e.i
    Table1:
    have
    FieldID Primary
    field1
    field2
    field3
    field3

    Table2:
    ID Primary
    FieldID Foreign
    field9
    field8
    field7
    field6

    my question is i wanted to copy the data from table1.Field1 to table2.Field9

    how can i do this in access using Query?

    please help....
    Last edited by edgarbenilde; Mar 29th, 2008 at 11:22 PM.

  2. #2
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950

    Re: hi, all.. access db help..

    INSERT INTO table2 (FieldID, field9, field8...)
    SELECT Table1.FieldID, Table1.Field1, Table2.field2...
    FROM Table1

    Unless you have a specific reason, there should be no reason to insert more than table1 primary key into table2 as a foreign key, since a query could normally return you the same values.
    Tengo mas preguntas que contestas

  3. #3
    Frenzied Member
    Join Date
    Aug 2006
    Location
    India, Punjab, Bhatinda
    Posts
    1,689

    Re: hi, all.. access db help..

    you can simply use update/Append query

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: hi, all.. access db help..

    Well, if he is populating empty tables with records from another table there really won't be anything to UPDATE

    The INSERT/SELECT, as previously posted, would be the way to go.

  5. #5
    Addicted Member
    Join Date
    Feb 2006
    Posts
    185

    Re: hi, all.. access db help..

    do you like to use this

    Code:
    rst2.addnew
    rst2.Field9 = rst1!Field1 
    rst2.update

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2007
    Posts
    839

    Re: hi, all.. access db help..

    ok, so if my statement is like salvelinus in POST # 2..

    what should be my connection string would be... do i have to do to connect 2 tables in using one connection with VB .Net 2005..?

  7. #7
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: hi, all.. access db help..

    A connection string specifies the database to connect to. You should use the same connection for all tables in a database.

    If the tables are in different databases, you need to do extra work.. exactly what depends on which way around the tables/databases are.

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