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....?
Printable View
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....?
can be acheived with an UPDATE SQL statment. (Access)
or create the query that carries out your update in access and call it from codeCode:
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];"
Not tested but HTHCode:
DoCmd.OpenQuery "QueryName", acViewNormal
Brian
hey, just out of pure interest, what's HTH mean??!?!?
Hope This helps :D