954,157 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

help

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
<strong>rs1.Fields![quantity] = Val(rs1.Fields![quantity]) + Val(rs2.Fields![quantity])</strong>
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. .

ryan311
Posting Whiz in Training
254 posts since Jul 2008
Reputation Points: 3
Solved Threads: 5
 

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
<strong>rs1.Fields![quantity] = Val(rs1.Fields![quantity]) + Val(rs2.Fields![quantity])</strong>
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

vb5prgrmr
Posting Virtuoso
1,912 posts since Mar 2009
Reputation Points: 156
Solved Threads: 296
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You