Smiley1
06-26-02, 05:18
| Hi Again, I am trying to insert records in to a MS Access Db with the following Qry = "INSERT INTO " & SourceTable(x) & " IN " & DbBackup _ & " SELECT " & SourceTable(x) & ".* " _ & "FROM " & SourceTable(x) MyDb.Execute (Qry) And it works fine. My problem is I only want to insert records in the Target Database Table where they exist in the Source Database Table but NOT the Target Database Table. So I modified my query as the following Qry = "INSERT INTO " & SourceTable(x) & " IN " & DbBackup _ & " SELECT " & SourceTable(x) & ".* " _ & "FROM " & SourceTable(x) & " WHERE isnull([Job No])" MyDb.Execute (Qry) Now obviously this does not work because the NULL test is being done on The Source Table and Not the Target. I have tried the following MyDb.Execute "SELECT " & SourceTable(x) & ".* INTO " & SourceTable(x) & " IN " & DbBackup _ & " FROM " & SourceTable(x) _ & " WHERE isnull([Job No]) IN (Backup.mdb);" but I get a syntax error. Can anyone help Many Thanks |