D
Delete a record from a listbox
Hello
I am working on an Access 2k app. One of my forms uses a listbox to show an
employee list. I want to be able to add and delete names from this list.
Adding isn't so hard but deleting seems to be. So far I have...
Private Sub cmdDelete_Click()
On Error GoTo Err_cmdDelete_Click
Dim strSQL As String
' delete via listbox
strSQL = "DELETE employeesID, employees FROM [tblEmployees] WHERE
[employeesID] = & me!lstEmployees"
DoCmd.RunSQL strSQL
Me.lstEmployees.Requery
Forms!frmEmployees.Refresh
txtAddemployee.Text = vbNull
Exit_cmdDelete_Click:
Exit Sub
Err_cmdDelete_Click:
MsgBox Err.Description
Resume Exit_cmdDelete_Click
End Sub
but I get no response when I press the delete key with the name highlighted
in the listbox.
thanks for any help!
Steve
I am working on an Access 2k app. One of my forms uses a listbox to show an
employee list. I want to be able to add and delete names from this list.
Adding isn't so hard but deleting seems to be. So far I have...
Private Sub cmdDelete_Click()
On Error GoTo Err_cmdDelete_Click
Dim strSQL As String
' delete via listbox
strSQL = "DELETE employeesID, employees FROM [tblEmployees] WHERE
[employeesID] = & me!lstEmployees"
DoCmd.RunSQL strSQL
Me.lstEmployees.Requery
Forms!frmEmployees.Refresh
txtAddemployee.Text = vbNull
Exit_cmdDelete_Click:
Exit Sub
Err_cmdDelete_Click:
MsgBox Err.Description
Resume Exit_cmdDelete_Click
End Sub
but I get no response when I press the delete key with the name highlighted
in the listbox.
thanks for any help!
Steve