VB6 - Copy a tables columns to another table Within the same database

Hi everyone,
I have two tables "TableA" and "TableB" TableA has 9 columns and TableB has 4 columns. I created a new table "TableC" with 5 columns. I want to copy 3 columns from TableA(with its data) to TableC and Copy one column from TableB to TableC . I added a new column to TableC and this column will only contain the indexes of a column from TableA. After copying those columns, I want to delete the copied columns from TableA and TableB. My final objective is to make two of the fields(columns) in TableC a foreign key to TableA.
All of these tables reside within the same MS Access database.
What is my best code approach to accomplish this objective?
Thanks.
GiftX.
[698 byte] By [Giftx] at [2007-11-20 11:45:02]
# 1 Re: VB6 - Copy a tables columns to another table Within the same database
Doesn't sound like it's worth the time it'd take to do it once. I would create all new tables.
dglienna at 2007-11-9 19:32:34 >
# 2 Re: VB6 - Copy a tables columns to another table Within the same database
Hi dg,
You probably didn't get what my objective is. TableA and TableB already exist. I created TableC. I want to populate TableC with values from TableA then delete the copied values in TableA then link TableC to TableA.

The reason is that there are certain data I don't want residing in TableA, so I am creating a separate table to house those data.
Got it?
Thanks.
GiftX.
Giftx at 2007-11-9 19:33:34 >
# 3 Re: VB6 - Copy a tables columns to another table Within the same database
You want to add a foreign key to table a that shows where in the table the old data was. Draw out a picture. I can't see it.
dglienna at 2007-11-9 19:34:38 >
# 4 Re: VB6 - Copy a tables columns to another table Within the same database
Hi dg,
thanks for your input. Just forget about the Foreign Key issue. I'll work that out.

I simply want to copy specific fields from TableA and TableB into TableC. And after copying the fields to my new table(TableC), I want to delete the copied fields from TableA and TableB. I will later link all tables using relationships.

I know I can simply move data from one Recordset to another Recordset, but I want a more efficient way of doing it.

GiftX.
Giftx at 2007-11-9 19:35:38 >