Question : Access 2007 - Tables

My oS is Win Exp Prof and I am using Access 2007.   I have Tables A and Tables B.
Both have different fields.
Is it possible to : Using Table A as the primary, to add fields from Table B, together with their field names and field types, lengths, etc to Table A, without having to go to Table A and create all the fields that I wish to add from Table B to Table A.  Can I do this in a query or must it be in code. A simple solution will help as i am already confused and muddled. Thank u.

Answer : Access 2007 - Tables

Without using code, you could probably use something like this

select tablea.*, tableb.*
INTO tmp1
from tablea left join tableb.id= - tablea.id

The tricks are that
the tables must not have any same column name
only one table is allowed to have an autonumber field
the condition tableb.id should never equal -tablea.id (this is so that the join never succeeds, so no actual data is retrieved from b aside from the column types)

If you need to replace tablea, you can

drop table tablea

and follow up with

select *
into tablea
from tmp1

The drawback is that all relationships (if any existed) are now gone.
Random Solutions  
 
programming4us programming4us