Lee-Anne Waters via AccessMonster.com wrote:
Hi,
would someone please help me with this problem.
i have a list box that displays a persons various sub records. what i
want to do is to be able to double click a list box record and have
it deleted.
i'm just not sure on what code i need to do this
many thanks
Lee-Anne
On the listbox's Double-Click event add some code that will reference
the ListBox's value (bound the the ID of the selected record) and then
add some code to delete that record from the table (or use an SQL
statement/query).
It might look something like...
Dim myID as Long, mySQL as String
myID = Me![myListbox]
mySQL = "DELETE * FROM tblMyTable WHERE [myTableID] = " & myID & ";"
DoCmd.RunSQL mySQL
Hope that gives you somethig to work with. Oh and don't forget to
requery your listbox after you removed the record.
Me![myListBox].Requery
Br@dley