thanks for your reply for my earlier query,
What I am trying to do is i am editing RM item rate in RM master file.. my code doing it correctly, secondly i am updating bill_detail file for rate where that RM code is used in bill this also my code doing correctly, but third one where i am updating bill file for total_amt field (i.e. in bill_details, RM1, RM2, RM3 items stored and total of their rate*qty is stored in bill ) but here by codedoedn't work. My code updating only first record of bill file.
Now please look at my below code :-
If Rs.State = adStateOpen Then Rs.Close
Rs.Open "select * from product_master where sno=" & Val(LblSr.Caption), Cn, adOpenDynamic, adLockOptimistic
Rs("prod_type") = CmbType.Text
Rs("prod_sub_type") = TxtName.Text
Rs("rate") = Val(TxtRate.Text)
Rs("is_active") = Val(ChkActive.Value)
If Rs1.State = adStateOpen Then Rs1.Close
Rs1.Open "select * from bill_details where prod_sno=" & Val(LblSr.Caption), Cn, adOpenDynamic, adLockOptimistic
If Rs1.RecordCount > 0 Then
Dim OldRt As Integer
Dim bILL As Integer
Dim newrt As Integer
bILL = Rs1("Bill_sno")
Dim i As Integer
For i = 1 To Rs1.RecordCount
OldRt = Rs1("amt")
Rs1("rate") = Val(TxtRate.Text)
Rs1("amt") = Rs1("rate") * Rs1("qty") / 100
newrt = Rs1("amt")
up to here code is updating all records as per sql select command above, but blow line are only updating first record of bill table
If Rs2.State = adStateOpen Then Rs2.Close
Rs2.Open "Select * from bill where invoice_no =" & Rs1("Bill_sno"), Cn, adOpenDynamic, adLockOptimistic
If Rs2.RecordCount > 0 Then
Dim j As Integer
For j = 1 To Rs2.RecordCount
Rs2("total_amt") = Rs2("total_amt") - OldRt + newrt
Thanks in Advance
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!
No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.
Your password has been sent to:email@example.com
To follow this tag...
Thanks! We'll email you when relevant content is added and updated.
Share this item with your network: