I had a problem with updating a table with a composite key.The table was called order details extended and i received an excellent solution by the moderator Hans.I am trying now to imitate the new suggested solution to rewrite the function for appending the tables but i didnt succeed.Maybe it is too dificult
to rewrite it. May i ask for help ?The function want to rewrite in order to include 2 composite keys is the following
Function AppendToTable(SourceTable As String, TargetTable As String, LinkField As String)
Dim strSQL As String
On Error GoTo ErrHandler
strSQL = "INSERT INTO [" & TargetTable & "] " & _
"SELECT * FROM [" & SourceTable & "] " & _
"WHERE Not Exists " & _
"(SELECT * FROM [" & TargetTable & "] As T " & _
"WHERE T.[" & LinkField & "]=[" & SourceTable & _
"].[" & LinkField & "])"
' Execute append query
' Uncomment the following line if you want to inspect the SQL.
CurrentDb.Execute strSQL, dbFailOnError
MsgBox Err.Description, vbExclamation