Hum, I not really sure of your approach will work.
The normal approach for custom menus is to simply have the menu call your
code.
Most, if not all of my custom menus simply call code that is placed in a
standard module, or even in the forms module.
The only requiring for that code to be useable by a custom menu, or menu
popup is that you must declare the function to be public.
So, for your form that is to operate with your custom menu, you can in the
"on action" setting of the custom menu go
=MyPrintInvoice()
In your form, your code that runs would look like
Public Function MyPrintInvoice()
' code goes here to print invoice..something like
me.Refresh ' force a disk write
docmd.OpenReport "Invoice",,,"id = " & me!id
end if
So, as a matter of development, you can take your code that you had in
buttons on the form and MOVE those button to a custom menu bar and that
clears up a large amount of clutter.
You can also pass values from those menu options
So, we could go:
Public Function MyPrintInvoice(strOptionText as string)
' code goes here to print invoice..somting like
me.Refresh ' force a disk write
' do somthing with strOptionText...!!
.......
docmd.OpenReport "Invoice",,,"id = " & me!id
end if
Now, to have your custom menu options "pass" a value to the above sub, you
could put in the on-action setting of the menu
=MyPrintInvoice("My Option text goes here")
So, you can have your custom menu pass values, but most of the time that is
not required.
In fact, you simply have your menu options run code just like buttons on a
form do.....