Posted on 2004-10-20
I have created a linked table in my Access 2000 database that links to the desired table of a back end SQL server database.
I run my Macros (VBA) and I got following Run-time error:
Run-time error '3622'
You must use the dbSeeChanges option with OpenRecordset when accessing a SQL server table that has an Identity column.
Here is my piece of code:
Dim db As Object
Dim rec As Object
Dim TableToOpen As String
Set db = CurrentDb()
TableToOpen = DetermineRecordToOpen(strFileWithPath)
Set rec = db.OpenRecordset(TableToOpen, , dbSeeChanges)
Also I got following error message when I use any of a type option in OpenRecordset:
Set rec = db.OpenRecordset(TableToOpen, dbOpenDynaset, dbSeeChanges)
Run-time error '3001'
I have checked the string TableToOpen in my code, it has the name of the linked table.
Could you tell me what is wrong here and how to fix them? Thanks.