Suppress Macro Message (1 Viewer)

anski

Registered User.
Local time
Today, 18:34
Joined
Sep 5, 2009
Messages
93
I made my own right-click menu that has the Paste command. When a user right clicks on the form other than a text box and chooses Paste, Access will show the error message: The command or action 'Paste' isn't available now...

I have tried including On Error (Fail) and Set Warnings (False) in the macro but both did not work. How do I suppress the macro error message. tia.
 
Last edited:

isladogs

MVP / VIP
Local time
Today, 11:34
Joined
Jan 14, 2017
Messages
18,225
Suggest you restrict your right click menu so it only shows where it is available (as is the case with the default right click menu)
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 18:34
Joined
May 7, 2009
Messages
19,243
call a VBA code on your macro that will test if the Active Control is a Textbox or not.
 

anski

Registered User.
Local time
Today, 18:34
Joined
Sep 5, 2009
Messages
93
call a VBA code on your macro that will test if the Active Control is a Textbox or not.
I have decided to use On Mousedown Event. Can you correct my syntax because the one below does not work. Thank you.

Private Sub Detail_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = acRightButton And Me.ActiveControl = TextBox Then
DoCmd.AddMenu "Textbox test", "mcr_entry_menu"
End If
End Sub
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 18:34
Joined
May 7, 2009
Messages
19,243
there is already a "default" shortcut menu for forms/controls.
 

Gasman

Enthusiastic Amateur
Local time
Today, 11:34
Joined
Sep 21, 2011
Messages
14,301
I have decided to use On Mousedown Event. Can you correct my syntax because the one below does not work. Thank you.

Private Sub Detail_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = acRightButton And Me.ActiveControl = TextBox Then
DoCmd.AddMenu "Textbox test", "mcr_entry_menu"
End If
End Sub
I would expect you would need Type in there to test for a Textbox?, else you are just testing if the activecontrol is equal whatever is in a variable named Textbox?
 

Users who are viewing this thread

Top Bottom