0

i have error to my code in the bold word!

Set rs = New ADODB.Recordset
Set rs1 = New ADODB.Recordset
Set rs2 = New ADODB.Recordset
rs.Open "Select * from temp where pcode='" & txtEdit.Text & "'", cn, adOpenKeyset, adLockPessimistic
rs1.Open "Select * from product where brandname='" & txtEdit.Text & "'", cn, adOpenKeyset, adLockPessimistic
rs2.Open "Select * from Sold", cn, adOpenKeyset, adLockPessimistic
If rs1.RecordCount > 0 Then
[B]rs1.Fields![quantity] = Val(rs1.Fields![quantity]) + Val(rs2.Fields![quantity])[/B]
rs1.Update
End If
If rs.RecordCount > 0 Then
Label7.Caption = Format(Label7.Caption - rs!price * rs!quantity, "00.00")
rs.delete
rs.Requery
MsgBox "Product Successfully Delete", vbInformation
Call grdloader
txtEdit.Visible = False
End If

all i want is if the user delete the record then the quantity of the table in Sold must be + to the quantity table of product. .

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by vb5prgrmr
0

i have error to my code in the bold word!

Set rs = New ADODB.Recordset
Set rs1 = New ADODB.Recordset
Set rs2 = New ADODB.Recordset
rs.Open "Select * from temp where pcode='" & txtEdit.Text & "'", cn, adOpenKeyset, adLockPessimistic
rs1.Open "Select * from product where brandname='" & txtEdit.Text & "'", cn, adOpenKeyset, adLockPessimistic
rs2.Open "Select * from Sold", cn, adOpenKeyset, adLockPessimistic
If rs1.RecordCount > 0 Then
[B]rs1.Fields![quantity] = Val(rs1.Fields![quantity]) + Val(rs2.Fields![quantity])[/B]
rs1.Update
End If
If rs.RecordCount > 0 Then
Label7.Caption = Format(Label7.Caption - rs!price * rs!quantity, "00.00")
rs.delete
rs.Requery
MsgBox "Product Successfully Delete", vbInformation
Call grdloader
txtEdit.Visible = False
End If

all i want is if the user delete the record then the quantity of the table in Sold must be + to the quantity table of product. .

This is the third different question you have asked in this thread. You really should (In the future) start a new thread for each question. But to answer your question, with a question.
Does your rs have an edit method?
i.e. rs.edit

Good Luck

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.