Suppress Macro Message

anski

Registered User.
Local time
Today, 17:08
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:
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)
 
call a VBA code on your macro that will test if the Active Control is a Textbox or not.
 
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
 
there is already a "default" shortcut menu for forms/controls.
 
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

Back
Top Bottom