Cannot update. Database or object is read-only

time4d

New member
Local time
Yesterday, 21:58
Joined
Jan 4, 2010
Messages
3
Hello all,

I seem to be having problems with rst.edit
I am using a query to set my recordset. Inside the Query there are 3 tables: tbl_Profile, tbl_Base, tbl_Template

All 3 tables have a Primary Key assigned with auto number.
The keys are...
tbl_Profile primary f_ProfileID

tbl_Base primary f_BaseID
foreign f_ProfileID

tbl_Template primary f_TemplateID
foreign f_ProfileID
foreign f_BaseID

In the query, I am calling a few fields each from the tables. only one key, f_ProfileID, is being called from tbl_Base

Following is the setup of the recordset:
Dim wrk As Workspace
Dim dbs As Database
Dim rst As Recordset
Dim i, vrWorkingDays

Set wrk = DBEngine(0)
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("qry_Schedule_Base", dbOpenDynaset)

rst.MoveFirst
Do Until rst.EOF
vrWorkingDays = 0
If rst!f_WorkingDays >= 1 Then
For i = 1 To 7
If rst("f_WeekDayName" & i) = True Then
Me("txt_Total" & i) = Me("txt_Total" & i) + 1
vrWorkingDays = vrWorkingDays + 1
End If
Next i
Me!txt_ToGo = Me!txt_ToGo - 1
rst.Edit
rst("f_WorkingDays") = vrWorkingDays
rst.Update
End If
rst.MoveNext
Loop

I am getting the following error:
Cannot update. Database or object is read-only

if i try to debug, it will take me to rst.edit
Also, if i remove the tbl_Profile from the query, it works without giving the error. However, I am missing a information in my form that was being called from tbl_Profile.

Thanks is advance...
 
with all 3 tables in the query, you are correct, I cannot change anything.

If I remove the tbl_Profile from the query, I can open the form without any problems and also edit data directly from the query itself...
 

Users who are viewing this thread

Back
Top Bottom