Results 1 to 4 of 4

Thread: Macro Access 2000 - eplace table with new data

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2002
    Location
    Hampton Beach
    Posts
    513

    Question Macro Access 2000 - eplace table with new data

    I have two tables. Table1 and Table2

    How can I create a macro that will take the data in Table2 and replace the data in Table where the LastName is the same....?

  2. #2
    Addicted Member
    Join Date
    Jan 2002
    Location
    Glasgow, Scotland
    Posts
    202
    can be acheived with an UPDATE SQL statment. (Access)

    Code:
    Dim dbs as Database
    
    set dbs = CurrentDB
    
    dbs.Execute "UPDATE Table2 " _
    & " INNER JOIN Table1 ON Table2.[Last Name] = Table1.[Last Name] " _
    & " SET Table1.[FieldName] = Table2.[FieldName];"
    or create the query that carries out your update in access and call it from code

    Code:
    DoCmd.OpenQuery "QueryName", acViewNormal
    Not tested but HTH

    Brian
    Last edited by Br1an_g; Mar 11th, 2004 at 05:06 AM.
    if you fail to plan, you plan to fail

  3. #3
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    hey, just out of pure interest, what's HTH mean??!?!?

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  4. #4
    Addicted Member
    Join Date
    Jan 2002
    Location
    Glasgow, Scotland
    Posts
    202
    Hope This helps
    if you fail to plan, you plan to fail

Posting Permissions

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



Click Here to Expand Forum to Full Width