• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

VB6 question?

KeninMI

Senior member
I have a form with a data control tied to an Access database, a list box that is populated from the database, a combo box that fills from vb, a text box, and a picture box.

What I want to be able to do is use a command button to delete the current selected (selected in the list box)record from the database and refresh the listbox contents to reflect the record deletion.

Thanks in advance for any help !

Ken
 
Private Sub Command1_Click()

'Remove it from the database first
sqlstring = "Delete from tablename where NameofListBox = " & List1.ListIndex
execute sqlstring
List1.RemoveItem (List1.ListIndex) 'This removes currently selected item from listbox

End Sub


Does this help at all?
The sql string might be much different...how are you storing the list data in the db? Is it unique by list index? Or if it is just the list item text, then your sql string would be like this:
sqlstring = "Delete from tablename where listtext = '" & List1.text & "'"


Let me know.
 
Back
Top