General information
Category:
Menus & Menu designer
How to click a button lying on a form thru a short cut menu. On doing so, I face an error "THIS can only be used within a method."
The actual command is 'This.parent.cmdSales.Click'
A menu isn't a child of anything, and what's more, isn't an object, so THIS.Parent is never going to work in a menu procedure.
A menu hit is more like an ON KEY interrupt, you can only address things that are in scope. So you must obtain a reference to your form through some other mechanism. Many people use _screen.ActiveForm or similar, i.e. the command in your menu procedure would be
_screen.ActiveForm.cmdSales.Click()
I'm not saying this would work for you; I'm saying you need to find another way to address your form.
I hope this helps,
- Colin
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only