467,169 Members | 986 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,169 developers. It's quick & easy.

-2147217887 Could not update; Currently Locked

Have a vb6 program that was connecting to an Access 97 database. We have converted the database to Access 2003 and changed the provider to use Jet 4.0

Now we are running into Could not update; Currently Locked when we are trying to add records to a table. Here is the code inserting records into the database. It works 95% of the time but if we are inserting a lot of data, it starts to get record locks.

Public Sub Store(Conn As ADODB.Connection, Day As Date, _
nType As cNodeType, ID As Long, Name As String, _
Origin As String, Location As String, Forecast As Variant)

Dim Stored As New ADODB.Recordset
Dim i As Integer
Dim iReSave As Boolean
On Error GoTo ErrorOnSave

Stored.Open "forecasts", _
Conn, adOpenStatic, adLockOptimistic


Stored.AddNew
Stored!Updated = Now
Stored!Date = Day
Stored!Type = nType
Stored!ID = ID
Stored!Name = Name
Stored!Origin = Origin
Stored!Location = Location

For i = 0 To 95
Stored.Fields(i + 7).Value = Forecast(i, 0)
Next

Stored.Update
Stored.Close
End Sub
Sep 9 '06 #1
  • viewed: 4271
Share:
1 Reply
PEB
Expert 1GB
PEB
Have a vb6 program that was connecting to an Access 97 database. We have converted the database to Access 2003 and changed the provider to use Jet 4.0

Now we are running into Could not update; Currently Locked when we are trying to add records to a table. Here is the code inserting records into the database. It works 95% of the time but if we are inserting a lot of data, it starts to get record locks.

Public Sub Store(Conn As ADODB.Connection, Day As Date, _
nType As cNodeType, ID As Long, Name As String, _
Origin As String, Location As String, Forecast As Variant)

Dim Stored As New ADODB.Recordset
Dim i As Integer
Dim iReSave As Boolean
On Error GoTo ErrorOnSave

Stored.Open "forecasts", _
Conn, adOpenStatic, adLockOptimistic


Stored.AddNew
Stored!Updated = Now
Stored!Date = Day
Stored!Type = nType
Stored!ID = ID
Stored!Name = Name
Stored!Origin = Origin
Stored!Location = Location

For i = 0 To 95
Stored.Fields(i + 7).Value = Forecast(i, 0)
Next

Stored.Update
Stored.Close
End Sub
Hi,

Do you use the database in shared mode?

Have you checked the settings of the connection?

There is a lot of network properties that have to be set like ODBC timeout
ODBC refresh

Number of locks per page and so on that have to be checked in the Access database...

Locked records per page

So please search for them in Ms access help... Maybe you have to change some property...


Have a nice day

:)
Sep 9 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Anastassios Giannaras | last post: by
1 post views Thread by G Gerard | last post: by
reply views Thread by Access Programming only with macros, no code | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.