Listbox and SQL statement

  • Thread starter Thread starter Jay
  • Start date Start date
J

Jay

How can I have it when someone clicks on a line in my
listbox a delete query will run to delete the row that is
highlighted.
 
Hi,
I'm going to have to make a few assumptions here.
Mainly that the bound column of your listbox is the primary key of the table that
is used to populate the box and the listbox IS NOT multi-select

Dim strSql As String

strSql = "Delete From yourTable Where id = " & Me.yourListbox
CurrentDb.Execute strSql

substitute the correct field name for 'id'

That should get you started.
 
Back
Top