I have the following code:
Dim rst As DAO.Recordset
Dim db As DAO.Database
Dim rst2 As DAO.Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("MainRptDataASD Totals")
rst.MoveFirst
.
.
.
If myVal <> 0 And rst.Fields("PmtYr") < 2005 Then
'Find the next year matching ASD(myCat) and IPR(myIRP)
Set rst2 = db.OpenRecordset("SELECT " & monVal & " from MainRptDataASD where PlanName = '" & myplan & "' AND PmtYr = " & myYear + 1 & " AND ASD = '" & myCat & "' AND IPR = '" & myIPR & "'")
calcVal = (rst2.Fields(monVal) / myVal - 1)
rst.Edit
rst.Fields(totval) = calcVal
rst.Update
Else
rst.Edit
rst.Fields(totval) = 0
rst.Update
End If
When I reach the rst.edit lines I get the error message - database or object is read-only. This is not a read only db.
Any thoughts on how to correct this?
Thanks,
k
Dim rst As DAO.Recordset
Dim db As DAO.Database
Dim rst2 As DAO.Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("MainRptDataASD Totals")
rst.MoveFirst
.
.
.
If myVal <> 0 And rst.Fields("PmtYr") < 2005 Then
'Find the next year matching ASD(myCat) and IPR(myIRP)
Set rst2 = db.OpenRecordset("SELECT " & monVal & " from MainRptDataASD where PlanName = '" & myplan & "' AND PmtYr = " & myYear + 1 & " AND ASD = '" & myCat & "' AND IPR = '" & myIPR & "'")
calcVal = (rst2.Fields(monVal) / myVal - 1)
rst.Edit
rst.Fields(totval) = calcVal
rst.Update
Else
rst.Edit
rst.Fields(totval) = 0
rst.Update
End If
When I reach the rst.edit lines I get the error message - database or object is read-only. This is not a read only db.
Any thoughts on how to correct this?
Thanks,
k