By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,806 Members | 1,490 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,806 IT Pros & Developers. It's quick & easy.

Shortcut menu action syntax

P: n/a
I have set up shortcut menus on many form successfully.

However, for the first time, I am trying to set one up on a subform.
In the 'On Action:' when customising the menu item I have:
=Forms![OrderDetails].showAvailability()

showAvailability is a public function in the module of the form
OrderDetails. This follows the working pattern for all other forms.

When I right click the item in the shortcut menu, I get the error:
"The object you referenced in the Visual Basic procedure as an OLE
object isn't an OLE object."

In this case OrderDetails is a subform of the form "Orders".

I note that if I open the Form OrderDetails on its own (as an
experiment) the right click works but not when it is opened as a
subform.

Should I amend the action to reflect this and if so, how?


Jul 31 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Build a public function in the "main" (parent) form.
Public Function ShowAvailability

me.orderDetails.Form.ShowAvailability()

end if

Now, in the on-action for your menu bar, go:

=ShowAvailability()
Don't include the forms qualifier for a menu, else it will run 3
times...(long time bug in access).

Remember, the form that has the focus is which form the public function will
run. So, to run code in sub-forms you best build a function in the parent
form that simple calls the sub-form code...
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
Jul 31 '08 #2

P: n/a
On Jul 31, 9:08*pm, "Albert D. Kallal" <PleaseNOOOsPAMmkal...@msn.com>
wrote:
Build a public function in the "main" (parent) form.

Public Function ShowAvailability

* *me.orderDetails.Form.ShowAvailability()

end if

Now, in the on-action for your menu bar, go:

=ShowAvailability()

Don't include the forms qualifier for a menu, else it will run 3
times...(long time bug in access).

Remember, the form that has the focus is which form the public function will
run. So, to run code in sub-forms you best build a function in the parent
form that simple calls the sub-form code...

--
Albert D. Kallal * *(Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKal...@msn.com
Thanks. After much experimentation I had just worked out how to do it
via the main form. Glad to know that that is the recommended (only?)
way.

I had not realised about leaving out the forms qualifier in the menu.
I had overcome the error by suitable code in the form's error event.
Leaving out the qualifier makes it simpler to write.

Jim

Jul 31 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.