I have the same problem and it is related to the Office update 2312 which was released on 5 January. As a workaround, you could switch back to a previous version of Office (e.g. 2311).
When I run RefreshLink, I get an error saying "Primary key already exists"
I'm using Visual Studio 2019's Visual Basic.
To reconnect the link table of the Access file,
The reference is set to "Microsoft Office 16.0 Access database engine Object Library".
When using this to set a new connection destination and execute RefreshLink, an error message "Primary key already exists" will now occur.
I was able to successfully reconnect the link table until January 5, 2024.
I have asked this question because an error suddenly started appearing on January 9, 2024.
Dim dao1 As Object
Dim dao2 As Object
dao1 = New Microsoft.Office.Interop.Access.Dao.DBEngine
dao2 = dao1.OpenDatabase(Access file path)
for loop = 0 To dao2.TableDefs.Count - 1
dao2.TableDefs(loop).Connect = Reconnect destination
dao2.TableDefs(loop).RefreshLink()
next
9 additional answers
Sort by: Most helpful
-
Colin Riddington 141 Reputation points MVP
2024-03-01T11:40:12.6066667+00:00 You may have missed my reply to @Jean-Philippe George above so I'm repeating it below
I can now give a definitive answer to explain what has happened. The fix was supplied to the Current Channel on 30 Jan without needing a version update. However, that fix wasn't applied to the Monthly Enterprise Channel (MEC) which is being used by @Jean-Philippe George and @Greg Youdale. The Access team have confirmed it will be fixed in the next update in the MEC to Version 2401 on 12th March. As that is still 2 weeks away, until then I suggest you use the work-around to handle error 3283 as suggested by Greg earlier. This will allow the links to refresh successfully with no messages. Alternatively if it is feasible for your organisation, consider changing to Current Channel(at least temporarily) I have just updated my web article with the above info and there is a similar article published on the AccessForever blog