BeardedSith
Member
- Local time
- Today, 08:43
- Joined
- Feb 5, 2020
- Messages
- 73
I have a form (frmRewards) that has a listbox (lstCustomers) which is used to select customers from a list. When you double-click the customer's name, the rest of the form is populated (no subforms).
When I delete the record, I get the infamous #Deleted issue in the listbox. I've tried a couple different methods I've found around the internet (and these forums) but none seem to work.
cmdDelete_Click() control:
Right now the code is a mish-mash of different ideas to tackle this problem, but none seem to work (Me.Dirty & Me.Requery specifically). Outside of closing the form and re-opening it, what else could I try here? I know this is a safety mechanism within Access to let the user know they deleted a record, but I'd rather accomplish that with Message Boxes and just make the record disappear completely!
When I delete the record, I get the infamous #Deleted issue in the listbox. I've tried a couple different methods I've found around the internet (and these forums) but none seem to work.
cmdDelete_Click() control:
Code:
Private Sub cmdDelete_Click()
Dim Response As Integer
On Error GoTo cmdDelete_Click_Err
DoCmd.SetWarnings False
If MsgBox("Confirm deletion of the record?", vbQuestion + vbYesNo + vbDefaultButton2, "Delete?") = vbYes Then
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.GoToRecord , , acNewRec
If Me.Dirty = True Then
Me.Dirty = False
End If
Me.Requery
Me.lstCustomers.Value = ""
Me.txtFilter.Value = ""
End If
cmdDelete_Click_Exit:
Exit Sub
cmdDelete_Click_Err:
MsgBox Error$
Resume cmdDelete_Click_Exit
End Sub
Right now the code is a mish-mash of different ideas to tackle this problem, but none seem to work (Me.Dirty & Me.Requery specifically). Outside of closing the form and re-opening it, what else could I try here? I know this is a safety mechanism within Access to let the user know they deleted a record, but I'd rather accomplish that with Message Boxes and just make the record disappear completely!