|
-
Mar 29th, 2008, 11:17 PM
#1
Thread Starter
Fanatic Member
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.
-
Mar 30th, 2008, 12:52 AM
#2
Frenzied Member
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
-
Apr 3rd, 2008, 06:06 AM
#3
Frenzied Member
Re: hi, all.. access db help..
you can simply use update/Append query
-
Apr 3rd, 2008, 09:21 AM
#4
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.
-
Apr 3rd, 2008, 09:37 AM
#5
Addicted Member
Re: hi, all.. access db help..
do you like to use this
Code:
rst2.addnew
rst2.Field9 = rst1!Field1
rst2.update
-
Apr 6th, 2008, 01:15 AM
#6
Thread Starter
Fanatic Member
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..?
-
Apr 6th, 2008, 11:29 AM
#7
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|