I have a simple form where I need to delete the current record.
I can delete the record via
DoCmd.RunCommand acCmdDeleteRecord
or using the Menu Commands just fine.
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
The problem comes in when I add confirmation, I get an error 2046. I have used both Select Case and If statements, which I put flags in to verify they went to the correct location in my code. I looked at other posts on this, and my code follows what I have seen, and I use this same code in some of our other Apps. I also found a post where it was suggested to use the select before the delete (as in the menu option), same issue.
Does anyone have any idea what I have done so I don't duplicate it or have a resolution?
Any help is greatly appreciated,
Rube
Select Case MsgBox("This will delete " & Me.FirstLast & ", Continue?", vbYesNo + vbQuestion, "Delete Staff Member")
Case Is = vbYes
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True
End Select
I can delete the record via
DoCmd.RunCommand acCmdDeleteRecord
or using the Menu Commands just fine.
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
The problem comes in when I add confirmation, I get an error 2046. I have used both Select Case and If statements, which I put flags in to verify they went to the correct location in my code. I looked at other posts on this, and my code follows what I have seen, and I use this same code in some of our other Apps. I also found a post where it was suggested to use the select before the delete (as in the menu option), same issue.
Does anyone have any idea what I have done so I don't duplicate it or have a resolution?
Any help is greatly appreciated,
Rube
Select Case MsgBox("This will delete " & Me.FirstLast & ", Continue?", vbYesNo + vbQuestion, "Delete Staff Member")
Case Is = vbYes
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True
End Select