Results 1 to 3 of 3
  1. #1
    excellenthelp is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Mar 2014
    Posts
    93

    Runtime Error 3027: Cannot update. Database or object is read-only

    Hello accessers,



    I am struggling in figuring out where the faulty line(s) is/are in the code below. The error reads 'Run-Time Error '3027': Cannot update. Database or object is read-only.

    Here is what I have done...

    Big picture:
    -Code works in previous stand-alone database
    -Migrated everything to a new database
    -Code does not work in new database where a new database with a backend and few frontends were created

    The code:
    Code:
    Private Sub Command56_Click()
        Dim i As Long
              
          With Screen.ActiveForm.[AMID]
          
                Dim stNextUser As String
                Dim MyDB As Database, RS As Recordset
                Set MyDB = DBEngine.Workspaces(0).Databases(0)
                
                stNextUser = ""
            
                Set RS = MyDB.OpenRecordset("select * from qryAIA_WorkloadAssignment")
                lngRSCount = RS.RecordCount
                If lngRSCount <> 0 Then
                    RS.MoveFirst
                    
                    stNextUser = Trim(RS.Fields("EmployeeName").Value)
                    
                    RS.Edit   <---Debug leads to here (Error)
                    RS.Fields("LastAssignment").Value = Now()
                    RS.Update
                    RS.Close
                    MyDB.Close
                   
                Else
                    RS.Close
                    stMsg = MsgBox("A serious error has occured: Please check the User Console to be sure that an Accreditation Manager is able to be assigned to.", vbCritical)
                    MyDB.Close
                End If
        
          DoCmd.GoToRecord , , acNewRec
        
            For i = 0 To .ListCount
                        
                If .ItemData(i) = stNextUser Then
                
                    .Value = stNextUser
                    MsgBox "Accreditation Manager " & stNextUser & " has been assigned to this activity and the Last Assignment date has been updated.", vbApplicationModal
                End If
            Next i
          
        End With
    End Sub
    Any help would be awesome!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,920
    I am guessing qryAIA_WorkloadAssignment is not editable.
    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.

  3. #3
    excellenthelp is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Mar 2014
    Posts
    93
    Thanks for the suggestion. I went ahead and made a different query and it works this time.

    Marking this as SOLVED.

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

Similar Threads

  1. Replies: 2
    Last Post: 11-18-2014, 08:56 AM
  2. Replies: 5
    Last Post: 04-22-2013, 12:32 PM
  3. 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
  4. Runtime Error 3027
    By jsbotts in forum Queries
    Replies: 4
    Last Post: 08-27-2011, 06:42 PM
  5. Runtime Error '3027': Database or object is read only
    By 4x4Masters in forum Programming
    Replies: 4
    Last Post: 06-08-2010, 08:02 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