Consulting

Results 1 to 8 of 8

Thread: Table VBA

  1. #1

    Table VBA

    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?

  2. #2
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,296
    Location
    Unless you just want to learn how to do it with a Macro or VBA it is easier run an Append or Update Query.

  3. #3
    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?

  4. #4
    VBAX Expert Imdabaum's Avatar
    Joined
    Jun 2006
    Posts
    652
    Location
    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.
    Someday I'll understand everything...
    Even then...I'll still pretend I'm a beginner.

  5. #5
    Quote Originally Posted by Imdabaum
    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?

  6. #6
    VBAX Expert Imdabaum's Avatar
    Joined
    Jun 2006
    Posts
    652
    Location
    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
    Someday I'll understand everything...
    Even then...I'll still pretend I'm a beginner.

  7. #7
    Quote Originally Posted by Imdabaum
    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
    Last edited by lienlee; 08-03-2010 at 08:33 AM.

  8. #8
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •