Hi, I need help to write a vba code to create union queries from all the tables in my database.
All the fields are the same for all tables and the table name needs to be a field.
E.g
SELECT Table1.f1, Table1.f2, Table1.f3, "Table1" As f4TName FROM Table1
UNION SELECT Table2.f1, Table.f2, Table2.f3, "Table2" As f4TName FROM Table2
UNION SELECT TableN.f1, TableN.f2, TableN.f3, "TableN" As f4TName FROM TableN;
Thanks.
All the fields are the same for all tables and the table name needs to be a field.
E.g
SELECT Table1.f1, Table1.f2, Table1.f3, "Table1" As f4TName FROM Table1
UNION SELECT Table2.f1, Table.f2, Table2.f3, "Table2" As f4TName FROM Table2
UNION SELECT TableN.f1, TableN.f2, TableN.f3, "TableN" As f4TName FROM TableN;
Thanks.