Join by field name?

  • Thread starter Thread starter Jason Gyetko
  • Start date Start date
J

Jason Gyetko

Is it possible to join by a field name instead of the value? I have two
tables which I need to retrieve all records for each table where the field
names are equal (and leave out the fields that don't match up).

Ex: TableA.Field1 = TableB.Field1

TableA TableB
-------- -------
Field1 = Data1 Field1 = Data100
Field2 = Data2 Field2 = Data200
Field4 = Data4 Field3 = Data300
Field4 = Data400

I do NOT want to show TableB.Field3 in my query results. Any help would be
greatly appreciated. Thanks.
 
Not in a query without writing the query in using VBA. If you were using DAO,
you could loop through the field names and match the fields up. Then you could
put the fields in the Select clause.

This looks like a highly unusual thing to do. Also, you need to look at what
results you would get with two tables (especially if you didn't have any joins).
 
Thanks for the reply. We were able to restructure our tables so we don't
need to do it this way anymore.
 
Back
Top