I want updata database of Microsoft Access but VB6.0 warning error
Code:
Set objConnection = New ADODB.Connection
objConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=App.Path & "\database.mdb";Persist Security Info=False;Jet OLEDB:Database Password="123"
objConnection.Open
Set rsData = New ADODB.Recordset
rsData.Open "dulieuxuly", objConnection, adOpenKeyset, adLockOptimistic
Dim i, j As Single
j = 10
For i = 1 To j Step 1
rsData.AddNew
rsData!Num = i
Next
rsData.Update
'The command line in above very good but the command line below warning error
j = 24
rsDulieu.MoveFirst
For i = 15 To j Step 1
rsData!Num = i ' Warning Error in here (A)
rsData.MoveNext
Next
rsData.Update
(A): 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 want to update fields rsData!Num = i , can you help me ?
Re: I want updata database of Microsoft Access but VB6.0 warning error
Your problem is that u have a number of j "Addnew" commands and only one Update...The number shoud be the same so i think that putting also rsData.Update before Next will solve your problem
Re: I want updata database of Microsoft Access but VB6.0 warning error
Thread moved to Database Development forum (the "VB6" forum is meant for questions which don't fit in more specific forums)
corneagigi is correct about that, and note that it applies to both of your loops - for the second loop the .Update should be before the .MoveNext