PROBLEM: INSERT INTO & SELECT ................ WITH A TWIST
Posted on 2014-03-26
Here is my SQL Statement:
str_SQL1 = "INSERT INTO tbl_2 (Field_1, Field_2) SELECT Field_1, Field_2 FROM tbl_1 WHERE tbl_1.Field_2 = " & Supplied_Variable_1 & ";"
It works fine copying one or more records from tbl_1 over to tbl_2 based on the filter Supplied_Variable_1.
But here is the twist: I want to supply another variable (Supplied_Variable_2) into Field_2 of the target table (tbl_2) rather than what is found in tbl_1.Field_2. How do I do this?
Supplied_Variable_1 = 1200 (original query filter)
Supplied_Variable_2 = 2222
tbl_2 (after INSERT INTO is Run)
Last Question: Assuming proper syntax, can you have a table run this "Append" on itself?
str_SQL1 = "INSERT INTO tbl_1 (Field_1, Field_2) SELECT Field_1, Field_2 FROM tbl_1 WHERE tbl_1.Field_2 = " & Supplied_Variable_1 & ";"
Thanks for any help.