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!