Updating Access Table from Exel VBA

CarlRostron

Registered User.
Local time
Today, 16:33
Joined
Nov 14, 2011
Messages
88
I am trying to update an Access Table from Excel VBA and it is stopping on the update line:

Code:
  Set cn = New ADODB.Connection
  'MyConn = ThisWorkbook.Path & Application.PathSeparator & TARGET_DB

  cn.ConnectionString = "Provider = Microsoft.ACE.OLEDB.12.0;" & _
                        "Data Source = C:\Users\user\Desktop\Anton Kreil Mentoring\Database System\Institute DB.accdb"
  MsgBox cn.ConnectionString
  cn.Open

  Set rs = New ADODB.Recordset
  rs.Open "tblSymbol", cn, adOpenKeyset, adLockOptimistic, adCmdTable
  
  rs.AddNew

It fails at :
Code:
rs.AddNew
The nerror is runtime 3251, Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype

I appreciate any help
 
I have solved this. Sorry to have inconvenienced.

The problem was that I already had a connection to the Database in the Excel Workbook. I cleared this and now the code works fine :-)
 

Users who are viewing this thread

Back
Top Bottom