Add the following to each select statement in the union query ---
, "YourTableName" AS [TableName]

Signature
KARL DEWEY
Build a little - Test a little
> I've made a union query and I want to add now a column to this query
> Beside I want it to get the table name beside each record because these
[quoted text clipped - 12 lines]
>
> please really need your help.
tamerelrefaie - 16 Jul 2007 17:06 GMT
Really thanks alot Karl
> Add the following to each select statement in the union query ---
> , "YourTableName" AS [TableName]
[quoted text clipped - 15 lines]
> >
> > please really need your help.
SELECT Field1, FIeld2, "Table1" As DataSource
FROM Table1
UNION
SELECT Field1, FIeld2, "Table2"
FROM Table2
UNION
SELECT Field1, FIeld2, "Table3"
FROM Table3

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
> I've made a union query and I want to add now a column to this query
> Beside I want it to get the table name beside each record because these
[quoted text clipped - 13 lines]
>
> please really need your help.
tamerelrefaie - 16 Jul 2007 17:06 GMT
Really thanks alot Douglas
> SELECT Field1, FIeld2, "Table1" As DataSource
> FROM Table1
[quoted text clipped - 22 lines]
> >
> > please really need your help.