Can't delete record 2046 - cause

rube

Registered User.
Local time
Today, 13:04
Joined
Jun 21, 2003
Messages
76
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
 
rube,

I tried your code with A2000 and windows XP and it ran fine.
I can't duplicate your problem.

Wayne
 
Only when conditional

Thanks for looking at it Wayne. I knew I have used this in other Apps. When you wrote me back, it told me there had to be a problem with my app somewhere. I made another copy of the form and got rid of all the code except the delete, same issue. I made another form and closed all other forms, it then worked.

When a user logs in, they have a Main Form that acts as their "Home", and gives Message and Action info, and navigates to other sections, it contains user information and does not allow edits/deletions/additions/etc. So when I would try to delete them in "frmStaff" it, it failed. It does not pull directly from the staff table, but the user does have a relationship stored there.

I appreciate you looking at this,

Rube
 

Users who are viewing this thread

Back
Top Bottom