MS ACCESS 2013-2016 continuous form shows error when adding any record past the 3rd when connected via ADO to SQL SERVER. Can this be fixed?

懵懂的女人 提交于 2021-01-28 19:08:30

问题


MS ACCESS 2013-2016 continuous forms show an error when adding any record past the 3rd.

I have connected via ADO to SQL SERVER.

I have been working on this issue for days. I am hoping there is something I can modify in my connection string, use a different library, or anything I can do in VBA to avoid building multiple workarounds in a project that has existed and grown over 20 years.

Is this a known issue? Can this be fixed?

Link to Continuous Form Showing Error

This is the form code I am using:

Option Compare Database

Private Sub Form_Open(Cancel As Integer)
Dim vConnString As String, vSQL As String
Dim v_ADO_RS As New ADODB.Recordset
Dim v_ADO_Conn As New ADODB.Connection

vConnString = "Provider=SQLOLEDB;Data Source=Rockware19\SQL_2012;" & _
              "Initial Catalog=System;" & _
              "User ID=***;Password=****;"
vSQL = "SELECT * FROM setcolor"

v_ADO_Conn.Open vConnString

With v_ADO_RS
    Set .ActiveConnection = v_ADO_Conn
    .CursorLocation = adUseClient
    .Source = vSQL
    .LockType = adLockOptimistic
    .CursorType = adOpenKeyset
    .Open
End With

Set Me.Recordset = v_ADO_RS
End Sub

This is an example of one of the SIMPLE SQL SERVER tables I am connecting to:

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[setColor](
    [ColorName] [varchar](50) NOT NULL,
    [MSAccess] [int] NULL,
    [Hex] [varchar](100) NULL,
 CONSTRAINT [PK_setColor] PRIMARY KEY CLUSTERED 
(
    [ColorName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

来源:https://stackoverflow.com/questions/60877397/ms-access-2013-2016-continuous-form-shows-error-when-adding-any-record-past-the

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!