Change msge "The DoMenuItem action was cancelled"

C

CW

I have a delete record button which fires a dialogue box and the user has to
click OK to proceed with the deletion, or close the box to abort.
It then says you are about to delete 1 record, do you want to continue, Yes
or No.
Yes works fine.
After hitting No I get a final dialogue box saying "The DoMenuItem action
was cancelled". This is logical enough, but not very user-friendly.
How can I modify that text to (say) simply "The action was cancelled" ??
Many thanks
CW
 
C

CW

Bob -
Here it is (it's a bit messy as I cobbled together bits of code from several
examples so feel free to recommend any improvements! Also, I used a label as
my button so that I could adjust the back colour) :

Private Sub Label203_Click()
On Error GoTo Err_Label203_Click

Dim myVar As Byte
myVar = MsgBox("Are you sure you want to delete this?", vbOKOnly)

If myVar = vbOK Then
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

Else

End If

Exit_Label203_Click:
Exit Sub

Err_Label203_Click:
MsgBox Err.Description
Resume Exit_Label203_Click

End Sub
 
B

boblarson

Okay, two things -

1. Why are you even asking them if they want to delete? Your current
message box will only let them delete and not let them NOT delete. You would
need to use something other than vbOKOnly to do this (like vbOkCancel or
something).

2. I suspect you want to select the record and then delete it. So, instead
of using the old deprecated DoMenuItem commands, try using:

DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top