Results 1 to 4 of 4
  1. #1
    mrfixit1170 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    42

    Can Not Update. Object is Read Only

    Hello All Happy New Year,
    I am having trouble with a application I started last summer (this app keeps biting back at me). I had to modify my original project to a FE/BE access2010/sqlserver2008, so I have been fixing and repairing what doesn't seem to work.
    The issue I am working on at the moment is fixing a particular editing option.

    Code:
    Private Sub btnSubmitSMEUPDATE_Click()
    Dim db As DAO.Database
    Dim rs1 As DAO.Recordset
    Dim rs2 As DAO.Recordset
    Dim rid As Long
    
    On Error GoTo ErrorHandler
    
    Set db = CurrentDb()
    Set rs1 = db.OpenRecordset("tbl_AVUM_Scored_Data", dbOpenDynaset, dbSeeChanges)
    Set rs2 = db.OpenRecordset("tbl_SME_AVUM_Edit", dbOpenDynaset, dbSeeChanges)
       
            Set ctl = Forms!frm_TaskList_Popup!List2
                With rs1
                    .AddNew
                    !EI_ID = Forms!frm_Acft_Score!EI_ID
                    !Event_Date = Forms!frm_Acft_Score!Event_Date
                    !Event_No = Forms!frm_Acft_Score!Event_No
                    !Sys_Code = Forms!frm_Acft_Score!Sys_Code
                    !IETM_ID = ctl
                    .Update
                    .Bookmark = .LastModified
                    rid = !Record_ID
                End With
                    
            Set ctl2 = Forms!Test1_AVUM_frm_SME_Update!lboAVUMSMEUpdate
                With rs2
                    .AddNew
                    !Record_ID = rid
                    !Maint_Funct = Forms!Test1_AVUM_frm_SME_Update!cboSMEMFo1
                    !MOS_ID = Forms!Test1_AVUM_frm_SME_Update!cboSMEMOSo1
                    !Time = Forms!Test1_AVUM_frm_SME_Update!txboSMETimeo1
                    !Comments = Forms!Test1_AVUM_frm_SME_Update!txboSMEAVUMComments
                    .Update
                End With
        
    ExitHandler:
        Set ctl = Nothing
        Set ctl2 = Nothing
        Set rs1 = Nothing
        Set rs2 = Nothing
        
        Me.lboAVUMSMEUpdate.Requery
        Me.lboAVUMSMEUpdate = ""
        Me.cboSMEMFo1.Requery
        Me.cboSMEMFo1 = ""
        Me.cboSMEMOSo1.Requery
        Me.cboSMEMOSo1 = ""
        Me.txboSMETimeo1.Requery
        Me.txboSMETimeo1 = ""
        Me.txboSMEAVUMComments.Requery
        Me.txboSMEAVUMComments = ""
        [Forms]![Test1_AVUM_frm_SME_Update].Requery
        [Forms]![frm_Acft_Score].[sfrm_AVUM_Scored_Data].Requery
        [Forms]![frm_Acft_Score].[qryTest2 subform].Requery
    Exit Sub
    
    ErrorHandler:
        Select Case Err
            Case Else
            MsgBox Err.Description
            DoCmd.Hourglass False
            Resume ExitHandler
        End Select
    
    End Sub
    This is tied to a table in SQl Server



    Code:
    CREATE TABLE [dbo].[tbl_SME_AVUM_Edit](
    	[Record_ID] [int] NULL,
    	[Maint_Funct] [int] NULL,
    	[MOS_ID] [nvarchar](255) NULL,
    	[Time] [real] NULL,
    	[Comments] [nvarchar](255) NULL,
    	[Date Added] [datetime] NULL
    This record only gets created when a user he/she edits exisiting Time, MOS or Maint Function and there is a Comment box to explain why the edit was needed.
    When I step through the vba code I keep getting sent to the error handler at the line "With rs2, .AddNew". The error message is "MS ACCESS Error Can Not Update. Object Is Read Only"....I am looking at the permissions on the SQL Server database and have added the users who are going to us the application with "Select,Connect,Update,Insert,Read,Delete" premission also db_datareader, and db_datawriter....
    I am not sure what else to chk.....anyhelp would be greatly appreciated
    Thanks again.

  2. #2
    Stingaway is offline Efficiency Junkie
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Location
    The deep south. Keep going until you hit water basically.
    Posts
    224
    Check to ensure that there are no relational key requirements on that back end table in sql. If you have relationships with other tables you generally have to have those tables in your query in order for the SQL backend to allow the Update.

  3. #3
    mrfixit1170 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    42
    I have the two tables called out in the VBA "tbl_AVUM_Scored_Data" and "tbl_AVUM_SME_Edit", they are related by the Record_ID field. If an edit is needed then the record(in the tbl_AVUM_SME_Edit) needs to be tied to the record in the "tbl_AVUM_Scored_Data" table. This combination is later used to make reporting information in another function.

  4. #4
    mrfixit1170 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    42
    I guess I fixed this problem.....I apparently needed to reestablish my links to my database. Refreshing the links will not fix the changes I made.......now everything seems to work.....thanks for the input Stingaway.

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

Similar Threads

  1. Replies: 1
    Last Post: 09-03-2011, 07:01 PM
  2. Allow Read or Update dep on record
    By AndreT in forum Forms
    Replies: 2
    Last Post: 07-31-2011, 09:46 PM
  3. Replies: 1
    Last Post: 07-17-2010, 08:55 PM
  4. Runtime Error '3027': Database or object is read only
    By 4x4Masters in forum Programming
    Replies: 4
    Last Post: 06-08-2010, 08:02 PM
  5. Replies: 2
    Last Post: 10-19-2006, 04:37 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