Start New Discussion within our Software Development Community

I am using the code below to update the fields in a table.bt it update only first recorde ..where m i doin wrong plzz. help me..!

StChk.Open "SELECT * From SPINF WHERE STATUS='Active'", Con, adOpenDynamic, adLockOptimistic
FeeTrans.Open "select * from TBLFEE ORDER BY VOUCHERNO", Con, adOpenDynamic, adLockOptimistic

Do While Not StChk.EOF

    FeeTrans.MoveFirst
    'StChk.MoveFirst

    If FeeTrans.Fields(2) = StChk.Fields(0) And FeeTrans.Fields(3) = StChk.Fields(45) Then
       
        StChk.Fields(39) = FeeTrans.Fields(26)
        FeeTrans.Fields(26) = 0
        FeeTrans.Fields(23) = True
        MsgBox ("Rc updated")
        FeeTrans.Update
        StChk.Update

    End If
      
      StChk.MoveNext
      FeeTrans.MoveNext
      
  Loop
  
  MsgBox ("All Records Has Transfered & Saved in new Receipts")

StChk.Close
FeeTrans.Close

FeeTrans.MoveFirst
'StChk.MoveFirst

It seems you keep on moving back to the first record within a loop. Remove the part "movefirst", because you WANT it to go to the next record as per your code at the end.

This question has already been answered. Start a new discussion instead.