all i want is change all the record in my table if the pcarrier="Credit" but my problem is only one data have been changes. .

Set rs = New ADODB.Recordset
rs.Open "Select * from Soldto where cno='" & Combo1.Text & "'", cn, adOpenKeyset, adLockPessimistic
If rs!pcarrier = "Credit" Then
Do Until rs.EOF
rs!pcarrier = "Paid"
rs.MoveNext
rs.Update
Loop
End If

help thanks. .

Try something like...

If rs.BOF = False AND rs.EOF = False AND rs.RecordCount <> 0 Then
  rs.MoveFirst
  Do While Not Rs.EOF
    rs.Edit
    rs!pcarrier = "Paid"
    rs.Update
    rs.MoveNext
  Loop
End If

a single update statement will do , why you need a loop for that.

a single update statement will do , why you need a loop for that.

I agree, but original poster is using loop and I am trying to help them with the logic of the loop and as to why only one of multiple records are being updated.

that ok, but updating records in a loop is not recommended as it takes a lot of system resources. and you have to commit very frequently , which again has a lot of side effects.

True, but look at the logic originally used. Just trying to get poster to think about their logic...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.