View Single Post
Join Date: Jul 2008
Posts: 161
Reputation: ryan311 has a little shameless behaviour in the past 
Solved Threads: 1
ryan311 ryan311 is offline Offline
Junior Poster

About Updating a Record in adodb

 
0
  #1
Dec 1st, 2008
Private Sub Command1_Click()
If Combo1.Text = "" Then
MsgBox "Please Choose Supplier Code", vbInformation
Combo1.SetFocus
Exit Sub
End If
If Combo2.Text = "" Then
MsgBox "Please Choose Product Code", vbInformation
Combo2.SetFocus
Exit Sub
End If
If Text1.Text = "" Then
MsgBox "Please Input the Quantity", vbInformation
Text1.SetFocus
Exit Sub
End If
If Text3.Text = "" Then
MsgBox "Please Input the Amount", vbInformation
Text3.SetFocus
Exit Sub
End If
rs.Open "Insert Into Deliver (scode, pcode, quantity, unit, amount, pcarrier, pterms, drnumber, date) Values ('" + Combo1.Text + "','" + Combo2.Text + "','" + Text1.Text + "','" + Text2.Text + "','" + Text3.Text + "','" + Text4.Text + "','" + Text5.Text + "','" + Text6.Text + "','" + Text7.Text + "')", cn, adOpenKeyset, adLockPessimistic
Set rs = Nothing
rs1.Open "select * from Product where pcode='" & Combo2.Text & "'", cn, adOpenKeyset, adLockPessimistic
If rs1.RecordCount > 0 Then
rs1.Fields![pstock] = Val(rs1.Fields![pstock]) + Val(Text1.Text)
rs1.Update
rs.Close
MsgBox "The Product has been save successfully", vbInformation
Combo1.Text = ""
Combo2.Text = ""
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Call Form_Load
Else
MsgBox "OHH NO!", vbInformation
End If
End Sub

i have a problem everytime i click my command1 button can anyone help me about my problem? please? badly needed rush! please help me god bless daniweb!


error is on about in INSERT INTO
Last edited by ryan311; Dec 1st, 2008 at 7:45 am. Reason: i forgot something
Reply With Quote