Keep value of autonumber column when importing into Microsoft Access database

后端 未结 3 2040
野趣味
野趣味 2021-01-15 10:02

What I try is to import several tables programmatically from Microsoft SQL Server to Microsoft Access.

Each SQL Server table has an identity column, and the correspo

3条回答
  •  猫巷女王i
    2021-01-15 10:48

    If you use Insert Into and specify all column names in MS Access, it should work.

    I just created a table with the following structure

    Id (autonumber)
    Firstname (text)
    Secondname (text)
    Lastname (text)
    

    I ran this statement

    docmd.RunSQL "insert into table2 (id, firstname, secondname, lastname) values (27, 'a', 'b', 'c')"

    It worked and inserted 27 into the autonumber column

提交回复
热议问题