PDA

View Full Version : Table VBA



lienlee
07-30-2010, 09:45 AM
Hi guys

I have a table which ill call A. A is the source of data. It contains all the data for multiple tables.

how can i copy certain columns/data into specific tables. For example
in table A - column B

will go to

Table B - column C

How can i do this with a macro?

OBP
07-30-2010, 10:50 AM
Unless you just want to learn how to do it with a Macro or VBA it is easier run an Append or Update Query.

lienlee
07-30-2010, 11:26 AM
i tried using append, but nothing happens when i run..see attachment

edit: i just learned that they have to be same column names..any other ideas?

Imdabaum
07-30-2010, 01:08 PM
The two tables having the same field name shouldn't cause a problem. You just need to reference which one is getting updated/appended. A.columnName, or B.columnName.

lienlee
08-02-2010, 05:12 PM
The two tables having the same field name shouldn't cause a problem. You just need to reference which one is getting updated/appended. A.columnName, or B.columnName.

A and B are table names?

Imdabaum
08-02-2010, 09:24 PM
Right. So if you have table A and table B and you both have field Name and you want to update table A.Name then following this pattern you should be able to update it.

Update A Set A.Name = B.Name WHERE B.Fieldx = A.Fieldy

lienlee
08-03-2010, 08:22 AM
Right. So if you have table A and table B and you both have field Name and you want to update table A.Name then following this pattern you should be able to update it.

Update A Set A.Name = B.Name WHERE B.Fieldx = A.Fieldy

UPDATE Integration_Interface SET Integration_Interface=ExportToTable
where Integration_Interface=Integration_Interface_Name = ExportToTable.Integration_Interface_Name;

cant seem to get it working

lienlee
08-03-2010, 11:42 AM
UPDATE ExportToTable LEFT JOIN Integration_Interface ON ExportToTable.ID = Integration_Interface.Integration_Interface_ID SET ExportToTable.I_I_name = [Integration_Interface].[Integration_Interface_Name];

i was able to get all the data i needed using this. but when i hit run. nothing happens.

it is set to update query.