S
SAC
I have a Access 2000 front end connected to a SQL server backend via ODBC.
I'm attempting to update a record via a recordset (rs.edit and rs.update
commands) and I keep getting the error:
The microsoft Jet Database engine stopped the process because you and
another user are attempting to change the same data at the same time.
I've very confident that I am the only one change data in this particular
table and I've used similar code to make changes in other tables.
The primary key of the table consists of OrderNumber and LineNo.
Here's the code I'm using:
Function BPCSConvertTWDHPO()
DoCmd.SetWarnings 0
Dim db As Database
Dim rs As Recordset
Dim strSQL As String
Dim strFind As String
Dim intCount As Integer
Dim strSQLTWDHPOTMP As String
Dim strDate As String
Dim strBOL As String
strSQLTWDHPOTMP = "SELECT TWDHPOTMP.* FROM TWDHPOTMP ORDER BY
TWDHPOTMP.PORD, TWDHPOTMP.PLINE;"
Set db = CurrentDb
Set rstmp = db.OpenRecordset(strSQLTWDHPOTMP, dbOpenDynaset)
Do While Not rstmp.EOF
intCounter = intCounter + 1
strMainFile = "SELECT TWDHPO.* FROM TWDHPO " _
& "WHERE TWDHPO.PORD = " & rstmp!PORD & " And TWDHPO.PLINE = " &
rstmp!PLINE & " " _
& "ORDER BY TWDHPO.PORD, TWDHPO.PLINE;"
Set rs = db.OpenRecordset(strMainFile, dbOpenDynaset, dbSeeChanges)
If rs.EOF Then
strSQL = "INSERT INTO TWDHPO SELECT TWDHPOTMP.* FROM TWDHPOTMP " _
& "WHERE TWDHPOTMP.PORD= " & rstmp!PORD & " AND TWDHPOTMP.PLINE= " &
rstmp!PLINE & ";"
DoCmd.RunSQL strSQL
Else 'No Match
rs.Edit
!PPROD = rstmp!PPROD
rs.Update
End If
NextRecord:
rstmp.MoveNext 'Loop through all the records in tmp table checking for adds
or updates
Loop
NextTable:
rs.Close
rstmp.Close
db.Close
End Function
Thanks for your help.
I'm attempting to update a record via a recordset (rs.edit and rs.update
commands) and I keep getting the error:
The microsoft Jet Database engine stopped the process because you and
another user are attempting to change the same data at the same time.
I've very confident that I am the only one change data in this particular
table and I've used similar code to make changes in other tables.
The primary key of the table consists of OrderNumber and LineNo.
Here's the code I'm using:
Function BPCSConvertTWDHPO()
DoCmd.SetWarnings 0
Dim db As Database
Dim rs As Recordset
Dim strSQL As String
Dim strFind As String
Dim intCount As Integer
Dim strSQLTWDHPOTMP As String
Dim strDate As String
Dim strBOL As String
strSQLTWDHPOTMP = "SELECT TWDHPOTMP.* FROM TWDHPOTMP ORDER BY
TWDHPOTMP.PORD, TWDHPOTMP.PLINE;"
Set db = CurrentDb
Set rstmp = db.OpenRecordset(strSQLTWDHPOTMP, dbOpenDynaset)
Do While Not rstmp.EOF
intCounter = intCounter + 1
strMainFile = "SELECT TWDHPO.* FROM TWDHPO " _
& "WHERE TWDHPO.PORD = " & rstmp!PORD & " And TWDHPO.PLINE = " &
rstmp!PLINE & " " _
& "ORDER BY TWDHPO.PORD, TWDHPO.PLINE;"
Set rs = db.OpenRecordset(strMainFile, dbOpenDynaset, dbSeeChanges)
If rs.EOF Then
strSQL = "INSERT INTO TWDHPO SELECT TWDHPOTMP.* FROM TWDHPOTMP " _
& "WHERE TWDHPOTMP.PORD= " & rstmp!PORD & " AND TWDHPOTMP.PLINE= " &
rstmp!PLINE & ";"
DoCmd.RunSQL strSQL
Else 'No Match
rs.Edit
!PPROD = rstmp!PPROD
rs.Update
End If
NextRecord:
rstmp.MoveNext 'Loop through all the records in tmp table checking for adds
or updates
Loop
NextTable:
rs.Close
rstmp.Close
db.Close
End Function
Thanks for your help.