Hi Chris,
This depends on what the rowsource of the listbox is.
If it's a table or query, you need to write VBA code that deletes the
corresponding record from the underlying table.
If it's a value list, you need to write code that deletes the
corresponding entry from the string that makes up the list.
>How would I select a listbox row and Delete that row from a list box? (Using
>a command button)
--
John Nurick [Microsoft Access MVP]
Please respond in the newgroup and not by email.
Chris - 30 Dec 2004 18:46 GMT
It's based on a query.
I'm sure I've done it with a "DoCmd" command (linking with the ID id the
listBox)
However I can't remember how to do that and have tried using
the recordset to delete the record. Again I just can't figure it out
Please Help me before New Year
> Hi Chris,
>
[quoted text clipped - 13 lines]
>
> Please respond in the newgroup and not by email.
John Nurick - 30 Dec 2004 22:15 GMT
Something like this air code should do it:
Dim strSQL As String
strSQL = "DELETE * FROM MyTable WHERE KeyField=""" _
& Me.lbXXX.Value & """;"
CurrentDB.Execute strSQL
Me.lbXXX.Requery
You'll need to replace
MyTable with the name of the table
KeyField with the name of the field in the table corresponding
to the bound column in the listbox
lbXXX with the name of the listbox (*not* the name of the field
the listbox is bound to).
>It's based on a query.
>
[quoted text clipped - 24 lines]
>>
>> Please respond in the newgroup and not by email.
--
John Nurick [Microsoft Access MVP]
Please respond in the newgroup and not by email.