Thenolos
Technical User
- Jul 15, 2004
- 38
I have a simple form where I use a combo box to select a record, and then a delete button to delete the record. For some reason, after I add the combo box selection code, the delete button either no longer works, or wants to delete an entire unrelated table... I'm completely clueless... Here's my code:
Private Sub Delete_User_Click()
On Error GoTo Err_Delete_User_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Exit_Delete_User_Click:
Exit Sub
Err_Delete_User_Click:
If Err.Number = 2501 Then
Resume Next
Else
Msgbox "error " & Err.Number & " " & Err.Description
End If
Resume Exit_Delete_User_Click
End Sub
Private Sub Form_BeforeDelConfirm(Cancel As Integer, Response As Integer)
Response = acDataErrContinue
If Msgbox("Are you sure you want to delete this User?", vbYesNo + vbCritical, "Deleting Record...") <> vbYes Then
Cancel = True
End If
End Sub
Any ideas what might be going on? I took out the combo box selection code and the delete button still does not work... Help would be appreciated.
Private Sub Delete_User_Click()
On Error GoTo Err_Delete_User_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Exit_Delete_User_Click:
Exit Sub
Err_Delete_User_Click:
If Err.Number = 2501 Then
Resume Next
Else
Msgbox "error " & Err.Number & " " & Err.Description
End If
Resume Exit_Delete_User_Click
End Sub
Private Sub Form_BeforeDelConfirm(Cancel As Integer, Response As Integer)
Response = acDataErrContinue
If Msgbox("Are you sure you want to delete this User?", vbYesNo + vbCritical, "Deleting Record...") <> vbYes Then
Cancel = True
End If
End Sub
Any ideas what might be going on? I took out the combo box selection code and the delete button still does not work... Help would be appreciated.