Hi,
Im having a few problems with updating and deleting an item out of a recordset.
I have a list box in a main form that lists all the items in the table. When you click on one it comes up with a new form that displays all the details in text boxes for that record. You are able to edit the text and there is a edit and also a delete record button. When you click them though, the record doesnt update or delete the record that was being viewed but deletes the record previous.
Used the following code.
[code=vb]
Private Sub cmdUpdate_Click ()
rs.Edit
rs.Fields("Firs tName") = TextBox(txtFirs tName)
rs.Fields("Last Name") = TextBox(txtLast Name)
rs.Fields("Stre et") = TextBox(txtStre et)
rs.Fields("Subu rb") = TextBox(txtSubu rb)
rs.Fields("Stat e") = TextBox(txtStat e)
rs.Fields("Post code") = TextBox(5)
rs.Fields("Phon eNumber") = TextBox(txtPhon eNumber)
rs.Fields("Mobi leNumber") = TextBox(txtMobi leNumber)
rs.Fields("Emai l") = TextBox(txtEmai l)
rs.Fields("Birt hday") = TextBox(txtBirt hday)
rs.Update
MsgBox ("Record Successfully Updated")
End Sub
[/code]
Thanks
Billybaub
Im having a few problems with updating and deleting an item out of a recordset.
I have a list box in a main form that lists all the items in the table. When you click on one it comes up with a new form that displays all the details in text boxes for that record. You are able to edit the text and there is a edit and also a delete record button. When you click them though, the record doesnt update or delete the record that was being viewed but deletes the record previous.
Used the following code.
[code=vb]
Private Sub cmdUpdate_Click ()
rs.Edit
rs.Fields("Firs tName") = TextBox(txtFirs tName)
rs.Fields("Last Name") = TextBox(txtLast Name)
rs.Fields("Stre et") = TextBox(txtStre et)
rs.Fields("Subu rb") = TextBox(txtSubu rb)
rs.Fields("Stat e") = TextBox(txtStat e)
rs.Fields("Post code") = TextBox(5)
rs.Fields("Phon eNumber") = TextBox(txtPhon eNumber)
rs.Fields("Mobi leNumber") = TextBox(txtMobi leNumber)
rs.Fields("Emai l") = TextBox(txtEmai l)
rs.Fields("Birt hday") = TextBox(txtBirt hday)
rs.Update
MsgBox ("Record Successfully Updated")
End Sub
[/code]
Thanks
Billybaub
Comment