There is a table with fields a, b, c, d. The type of fields is unknown in advance. You need to create a new table and copy the field c there and connect it with the field c in the original table.

Programming Environment: MS VBA 7.1

DBMS: Microsoft Access 2013

  • Necessary - create. What is the question is not clear. - Vladimir Martyanov
  • The question is how to do it? I do not know how to create a field of the "same data type" as with - Alexander Chi
  • Specify what the DBMS. - Vladimir Martyanov
  • DBMS: Microsoft Access 2013 - Added to the header - Alexander Chi
  • one
    intFieldType = CurrentDb.TableDefs ("table"). Fields (num) .Type - Nikola Tesla

2 answers 2

Easier to do this:

SELECT c Into new_table from Old_table; 

The table is created on the fly.

    Reply from Nikola Tesla

    To find out the data type for column N table M , refer to: CurrentDB.Tabledefs("M").Fields(N).Type - returns integer number - the numeric code of the data type of column N table M

    To copy column C from table A to table B , you need to run the query:

     SELECT C INTO B FROM A