I have two tables, tbl1 and tbl2, linked by a common primary key attribute. Each attribute of tbl2 is also in tbl1 with identical names and definitions, but tbl1 also contains other attributes not in tbl2.
At one point in a procedure, I need to create new records in tbl2 from corresponding records in tbl1, based on matching their key values. Because both tables have such a large number of attributes, I was hoping to use the * shortcut in the SQL statement as follows:
DoCmd.RunSQL ("INSERT INTO tbl2 SELECT * FROM tbl1 WHERE lngKeyValue = " & lngVBACurrentKeyValue)
I thought this would just deal with those attributes that are common to both tables. But of course it's giving a run-time error when it hits an attribute in tbl1 that isn't defined in tbl2.
I know I can replace the * with an explicit list of all the attribute names that are common to both tables, but this would make it a very long statement. So is there any other SQL statement that I can use that will just deal with the common attributes?