943,552 Members | Top Members by Rank

Ad:
Mar 8th, 2009
0

help

Expand Post »
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
rs1.Fields![quantity] = Val(rs1.Fields![quantity]) + Val(rs2.Fields![quantity])
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. .
Reputation Points: 3
Solved Threads: 5
Posting Whiz in Training
ryan311 is offline Offline
254 posts
since Jul 2008
Mar 8th, 2009
0

Re: help

Click to Expand / Collapse  Quote originally posted by ryan311 ...
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
rs1.Fields![quantity] = Val(rs1.Fields![quantity]) + Val(rs2.Fields![quantity])
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
Reputation Points: 156
Solved Threads: 296
Posting Virtuoso
vb5prgrmr is offline Offline
1,670 posts
since Mar 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Need a simple help. . .
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Opening PDF file in VB6 Form





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC