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....
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.
Re: hi, all.. access db help..
you can simply use update/Append query
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. :)
Re: hi, all.. access db help..
do you like to use this
Code:
rst2.addnew
rst2.Field9 = rst1!Field1
rst2.update
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..?
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.