Hi,
I am getting a seemingly random locking problem on several of my applications when adding rows to an access database table from VB6 using ADO.
Below is an example of what I am doing, but it is basically looping through an array of data and adding rows to a table using a recordset.
The error is '-2147217887: could not update; currently locked' and I've had it happen on my development machine with no one else accessing the database.
I've tried different combinations of lock type and cursor type with no luck.
Dim rsData As New Recordset
Dim x As Integer
sProvider = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & sDBPath
rsData.Open "stock", sProvider, adOpenDynamic, adLockPessimistic
For x = 1 To xaData.Count(1)
rsData.AddNew
rsData!item_code = sData(x,1)
rsData!description = sData(x,2)
rsData.Update
Next
Is there a better way to add the data?
Cheers
Marc