how-save-listitem from listbox-to ms access-vb6
here i attach the error msg.
i had some item in listbox and i remove
the duplicate item.i fnished this much with the help of ur vb forum
----------------------
how save that listitem
into ms access table?
then how i retrieve that value?
i try this codings.
-----------
Private Sub Command3_Click()
rs1.Open "select * from table1 where nid = " & Trim(Text1.Text), con, adOpenDynamic, adLockOptimistic
rs1.Fields("no") = Val(List1.Text) // save the item in table
MsgBox "added"
rs1.Update
rs1.Close
End Sub
--------------
//to retrieve the item
Private Sub Command1_Click()
rs1.Open "select * from table1 where nid = " & Trim(Text1.Text), con, adOpenDynamic, adLockOptimistic
rs1.AddNew
Text1.Text = rs1.Fields("nid")
Text3.Text = rs1.Fields("no") //get that item form table
rs1.Update
rs1.Close
----------------
please rectify the error
Re: how-save-listitem from listbox-to ms access-vb6
you forgot to addnew in this code
Code:
Private Sub Command3_Click()
rs1.Open "select * from table1 where nid = " & Trim(Text1.Text), con, adOpenDynamic, adLockOptimistic
rs1.AddNew
rs1.Fields("no") = Val(List1.Text) // save the item in table
MsgBox "added"
rs1.Update
rs1.Close
End Sub
and there i no need of red line in this code
Code:
//to retrieve the item
Private Sub Command1_Click()
rs1.Open "select * from table1 where nid = " & Trim(Text1.Text), con, adOpenDynamic, adLockOptimistic
'rs1.AddNew
Text1.Text = rs1.Fields("nid")
Text3.Text = rs1.Fields("no") //get that item form table
'rs1.Update
rs1.Close