Hello.
In the below code, the rst.Update method fails with the following error:
I restarted the DB and Access machine - I'm sure there's no other process addressing this table, except for this subroutine!
Any ideas?
In the below code, the rst.Update method fails with the following error:
Run-time error '3197':
The [COLOR=blue ! important][COLOR=blue ! important]Microsoft[/COLOR][/COLOR] Office Access [COLOR=blue ! important][COLOR=blue ! important]database [COLOR=blue ! important]engine[/COLOR][/COLOR][/COLOR] stopped the process
because you and another user are attempting to change the same
data at the same time.
I restarted the DB and Access machine - I'm sure there's no other process addressing this table, except for this subroutine!
Any ideas?
Code:
Public Sub UpdateSupplementsStock()
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim strQuery As String
Dim strSql As String
Dim SuppStock As SupplementStock
Set dbs = CurrentDb()
strQuery = "SELECT tblFood_supplements.Supplement_Code, tblFood_supplements.Units_in_Stock, tblFood_supplements.Last_Stock_Take_Date FROM tblFood_supplements"
' Open recordset on the query
Set rst = CurrentDb.OpenRecordset(strQuery, dbOpenDynaset)
Do While Not rst.EOF
SuppStock = SumSupplementStock(rst![Supplement_Code])
rst.Edit
rst![Units_in_Stock] = SuppStock.UnitsInStock
rst![Last_Stock_Take_Date] = SuppStock.StockDate
rst.Update
rst.MoveNext
Loop
rst.Close
dbs.Close
End Sub