Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21246

Performance is very slow running

$
0
0
Hello All, Is there a better way than the code below to speed up the process of saving the data because the code below takes time up to 17 second to saved data? Please need your advice to recode it to spped up process. Thank you in-advance.
Code:

  If TxActiveBlock.Text <> "" And CmActiveAgent.Text <> "" Then
   
    If rsReceived.State = adStateOpen Then rsReceived.Close
    rsReceived.Open "SELECT * FROM [TbStore] WHERE [Customer_Name] LIKE '%" & Trim(CmActiveAgent) & "%' OR [Block_Number] LIKE '%" & Trim(TxActiveBlock) & "%' order by (Block_Number)", dbContact, adOpenStatic, adLockOptimistic
   
    If rsReceived.RecordCount <> 0 Then    'and it try If NOT rsReceived.RecordCount = 0 Then
      rsReceived.MoveFirst
      Do While Not rsReceived.EOF
        rsReceived.Fields(6) = CmActiveAgent.Text
        rsReceived.Fields(4) = dtpReceived
        rsReceived.Update
        rsReceived.MoveNext
   
      Loop
      MsgBox "Data Saved Successfully "
    End If
   
    TxActiveBlock.Text = ""
    CmActiveAgent.Text = ""
   
  End If


Viewing all articles
Browse latest Browse all 21246

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>