Why am I getting the error in Access 2010 "Current Recordset does not support updatin

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • firebirdxvi
    New Member
    • Jun 2014
    • 4

    Why am I getting the error in Access 2010 "Current Recordset does not support updatin

    I am using Access 2010 and I am getting this error:

    "Current Recordset does not support updating. There may be a limitation of the provider, or of the selected locktype."

    Code:
    Dim SQLstr as String
    Dim R as ADODB.Recordset
    Set R = New ADODB.Recordset
    
    SQLstr = "SELECT * FROM TABLE1;"
    R.OPEN SQLstr, CurrentProject.Connection, _
    adOpenDynamic, adLockReadOnly
    
    R.AddNew 'error here
    I have tried many combinations of locktypes and tried to look at similar questions asked, but I have no idea why this error is happening. Thanks in advance for any input!
    Last edited by Rabbit; Jun 15 '14, 01:36 AM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
  • jimatqsi
    Moderator Top Contributor
    • Oct 2006
    • 1293

    #2
    firebird,
    Welcome to Bytes.com. Weekends arent't the busiest time here, but there's usually at least one guy on deck. I guess that's me, today, even though I don't use ADO much.

    If you read you own code you'll see the answer is obvious. You're opening the table in Read Only mode - read only means not in write mode.

    Take a look at this: http://www.w3schools.com/ado/prop_rs_locktype.asp

    Note the LockTypeEnum enumerator spells out the different values for that parameter. You probably want adLockOptimisti c.

    Jim

    Comment

    • firebirdxvi
      New Member
      • Jun 2014
      • 4

      #3
      Ha! Whoops. I thought I'd copied over directly from another module that worked so I was falsely confident that wasn't the problem.

      Of course I see it now and it works. Thanks for answering my question, I'm really new to this VBA stuff.

      Comment

      Working...