When the database calls this function it returns the runt-time error 3027 Can't update database or object is read only. I am opening the recordset with the Set rstOrders = dbs.OpenRecordset("qryRoundConfirmedORDERS")but when it moves to the rstOrders.Edit it errors? Where should I look next to debug?
Function RoundConfirmedOrders()
Dim dbs As Database, rstOrders As Recordset
Set dbs = CurrentDb
Set rstOrders = dbs.OpenRecordset("qryRoundConfirmedORDERS")
rstOrders.MoveFirst
Do Until rstOrders.EOF
rstOrders.Edit
If rstOrders!ORD_CERT = "D" Then
If Not IsNull(rstOrders!INV_SDEC) Then
rstOrders!ORD_CUTS = Round(rstOrders!ORD_CUTS, rstOrders!INV_SDEC)
Else
rstOrders!ORD_CUTS = Round(rstOrders!ORD_CUTS, 3)
End If
End If
If rstOrders!ORD_CERT = "U" Then
rstOrders!ORD_CCSH = Round(rstOrders!ORD_CCSH, 2)
End If
rstOrders.Update
rstOrders.MoveNext
Loop
rstOrders.Close
RoundConfirmedOrders = True
End Function
Function RoundConfirmedOrders()
Dim dbs As Database, rstOrders As Recordset
Set dbs = CurrentDb
Set rstOrders = dbs.OpenRecordset("qryRoundConfirmedORDERS")
rstOrders.MoveFirst
Do Until rstOrders.EOF
rstOrders.Edit
If rstOrders!ORD_CERT = "D" Then
If Not IsNull(rstOrders!INV_SDEC) Then
rstOrders!ORD_CUTS = Round(rstOrders!ORD_CUTS, rstOrders!INV_SDEC)
Else
rstOrders!ORD_CUTS = Round(rstOrders!ORD_CUTS, 3)
End If
End If
If rstOrders!ORD_CERT = "U" Then
rstOrders!ORD_CCSH = Round(rstOrders!ORD_CCSH, 2)
End If
rstOrders.Update
rstOrders.MoveNext
Loop
rstOrders.Close
RoundConfirmedOrders = True
End Function