Stop Access from using wrong identity when appending to linked table on SQL server

前端 未结 3 1353
野的像风
野的像风 2020-12-20 22:21

TL:DR; version:

If I insert a record into a linked table that has a trigger that inserts a record in a different table, Access displays the global i

3条回答
  •  庸人自扰
    2020-12-20 22:48

    You must be doing something else on that form.

    I would suggest you delete, and re-create the linked table from Access. I am unable to re-create your effect.

    Keep in mind that Access does not and will not display the auto number id until you move to a new record, or you hit ctrl-s to save the current record. However, there really no reason to worry or care about this "lack" of PK id on the Access form until such time a save has occurred.

    From what I can see is that you linked to the wrong table from Access. So I much suggest you delete the linked table in Access, re-link.

    And as a quick test, after you link the table, flip it into design mode to ensure that Access sees the PK (access will not see the PK if this is for example a view – but you “can” select the PK when linking to a view via the GUI).

    edit - I run your scripts - played a bit. I set the first table to auto inc at 1000. The screen shot after entering 3 rows is this:

    From what I can see, this is correct.

    edit#2: From a quick search on the internet - we see that you issue DOES exist, but I am at a loss as to why my example works 100% just fine.

提交回复
热议问题