Results 1 to 5 of 5
  1. #1
    Henners is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2018
    Posts
    6

    Error Cannot update. Database or object is read only. --- can I clone the dao recordset

    Hi,


    I have an Access DB linked to MSSQL.
    I am using a DAO.Recordset to hold my data, which comes from a View. I can understand that I am unable to update the recordset because it is a view.
    I would like to create a clone of the recordset and then use the clone to hold my changes but not commit those changes to the database. I will then use the clone in another process to add new records to another table.
    Does anyone know how to create a clone that will not keep the read-only properties, so I can update it?

    Also, I know it is possible I am sure I had to do this on another project 2 years ago for a company I worked for. But can't remember

  2. #2
    Henners is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2018
    Posts
    6
    Sorry to bother all fixed.
    Using this guy's function http://www.vbforums.com/showthread.p...13#post2263813
    I created an ADO recordset with a ADO recordset that does not keep the readonly properties.

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    According to Wiki a view can be defined as read-only or updatable.

    AFAIK, updating a RecordsetClone updates the underlying data source.

    Create records in table then edit them.

    Why do you need to replicate data to another table?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,979
    Not a direct answer to your question but a different solution

    SQL views CAN be updated in Access providing
    1. The view is updateable in SQL Server
    2. A primary key field is assigned to the view in Access

    Point 2 applies to any update query in Access. Even for local tables, a PK field is required

    How you assign a PK field will depend on how the view is linked in Access -ODBC or DSN less connection string
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Post 2 was moderated, I'm posting to trigger email notifications.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 08-15-2018, 02:52 PM
  2. Replies: 3
    Last Post: 07-20-2015, 12:23 PM
  3. Replies: 2
    Last Post: 12-19-2014, 07:41 AM
  4. Replies: 5
    Last Post: 04-22-2013, 12:32 PM
  5. Cannot update. Database or object is read-only ERROR
    By Namibia in forum Import/Export Data
    Replies: 2
    Last Post: 06-05-2012, 05:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums