| | |
![]() |
•
•
Join Date: Jul 2008
Posts: 161
Reputation:
Solved Threads: 1
i have error to my code in the bold word!
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. .
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 Ifall 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. .
•
•
Join Date: Mar 2009
Posts: 805
Reputation:
Solved Threads: 146
•
•
•
•
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. .
Does your rs have an edit method?
i.e. rs.edit
Good Luck
![]() |
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Need a simple help. . .
- Next Thread: Opening PDF file in VB6 Form
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





