Good day!
I have a running code but I found it not very fast in terms of saving data. Is there a way to make it more faster? I am using msaccess as databse.
Set RsTrandet = New ADODB.Recordset
Sql = "SELECT TranDetail.AccountNo,cashflowcode, TranDetail.Narration, TranDetail.TranNature, " & _
"TranDetail.TranAmount, Acctmaster.Accountname FROM TranDetail,Acctmaster where " & _
"TranDetail.AccountNo = Acctmaster.Accountno " & _
"and transactno = " & RsTranmain("transactno") & " order by serialno"
RsTrandet.Open Sql, SCNN, adOpenKeyset, adLockOptimistic
SCNN.Execute "delete from tran" & curtm
Slno = 0
LastSlno = 0
Set Rstemp = New ADODB.Recordset
Rstemp.Open "select * from tran" & curtm & " ", SCNN, adOpenKeyset, adLockOptimistic
SCNN.BeginTrans
Do While Not RsTrandet.EOF
If RsTrandet("TranNature") = "C" Then
Rstemp.AddNew
Slno = Slno + 1
Rstemp("Slno") = Slno
Rstemp("Accountno") = RsTrandet("Accountno")
Rstemp("Narration") = RsTrandet("Narration")
Rstemp("Tranamount") = Round(RsTrandet("Tranamount"), 2)
Rstemp("Accountname") = RsTrandet("Accountname")
Rstemp("CFCode") = IIf(IsNull(RsTrandet("CashFlowCode")), 0, RsTrandet("CashFlowCode"))
Rstemp.Update
Else
cmbAcctNo.Text = RsTrandet("Accountno")
txtTotal.Text = Round(RsTrandet("Tranamount"), 2)
txttotamt.Text = txtTotal.Text
TxtCFCode = IIf(IsNull(RsTrandet("CashFlowCode")), 0, RsTrandet("CashFlowCode"))
Call TxtCFCode_LostFocus
End If
RsTrandet.MoveNext
Loop
SCNN.CommitTrans
thank you!