Listbox and SQL statement

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.
 
D

Dan Artuso

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top