Editing an recordset

JayAndy

Registered User.
Local time
Today, 13:19
Joined
Jan 13, 2016
Messages
31
Hi All

Im am trying to edit this record set but keep getting:

Runtime error 3027 Cannot update. Database or Object is read only.

This is code l am using.

Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim StrString As String

StrString = "SELECT Timein.ID, Timein.[Employee Name], Timein.[Return Date]" _
& "FROM Logon INNER JOIN Timein ON Logon.Employee = Timein.[Employee Name]" _
& "WHERE (((Timein.[Return Date]) Is Null))" _
& "ORDER BY Timein.ID DESC;"

Set db = CurrentDb
Set rst = db.OpenRecordset(StrString)

Do Until rst.EOF
With rst

rst.Edit
rst("Return Date") = Date
rst.Update
End With
Loop

Can any see whats wrong Please
 
Last edited:
If you put the SQL string into the query designer I suspect because of the joins you can't update it either. You will probably need to use a right join. Play with it in the query designer to see how it works.
 
If you put the SQL string into the query designer I suspect because of the joins you can't update it either. You will probably need to use a right join. Play with it in the query designer to see how it works.


Thanks for your Reply have Tried that and Put a Left join on there and can edit it in the Query designer but still get the same error message
 
To be updateable tables need to be joined on primary keys
 

Users who are viewing this thread

Back
Top Bottom