Hi guys
I've searched around and it's the same old story - however no matter what i (seem to) do, when i delete from the listbox, the selected record doesn't get deleted, but in fact the FIRST record in the table (actually it's a query) gets deleted? I've tried making a cmdButton and double clicking to delete, but can someone give me the 'definitive' code to deleting a SELECTED record from a listbox (and infact from the query too) please?
I've used a few bits of code - some i might not have used properly... i've tried:
Private Sub List8_DblClick(Cancel As Integer)DoCmd.RunCommand acCmdSelectRecord 'select current record
DoCmd.RunCommand acCmdDeleteRecord 'delete selected record
Me.List8.Requery
End Sub
and also i've tried including stuff like
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[EnquiryID] = " & Me.EnquiryID
Me.Bookmark = rs.Bookmark
and some other stuff that i got off posts from wayne ryan and mile-o-phile... but like i say sometimes i'm not sure exactly how to adapt these... The situation is that the form is on linked to the customer form via a customerID, and it has it's own EnquiryID. So i wasn't sure which ID and Column etc i should use. I also tried a piece of code that wayne ryna gave but i don't wanna make this thread too long otherwise people won't read it

So if anyone could help, that'd be great, cheers
Edd
I've searched around and it's the same old story - however no matter what i (seem to) do, when i delete from the listbox, the selected record doesn't get deleted, but in fact the FIRST record in the table (actually it's a query) gets deleted? I've tried making a cmdButton and double clicking to delete, but can someone give me the 'definitive' code to deleting a SELECTED record from a listbox (and infact from the query too) please?
Private Sub List8_DblClick(Cancel As Integer)DoCmd.RunCommand acCmdSelectRecord 'select current record
DoCmd.RunCommand acCmdDeleteRecord 'delete selected record
Me.List8.Requery
End Sub
and also i've tried including stuff like
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[EnquiryID] = " & Me.EnquiryID
Me.Bookmark = rs.Bookmark
and some other stuff that i got off posts from wayne ryan and mile-o-phile... but like i say sometimes i'm not sure exactly how to adapt these... The situation is that the form is on linked to the customer form via a customerID, and it has it's own EnquiryID. So i wasn't sure which ID and Column etc i should use. I also tried a piece of code that wayne ryna gave but i don't wanna make this thread too long otherwise people won't read it
So if anyone could help, that'd be great, cheers
Edd
Last edited: