Parsing a parameter from a menu to a macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In a macro, how do you retreive the parameter value from the menu item that
called it.

Amiga1200
 
Don't use a macro. Call a public function in a standard module with the menu
item's OnAction Property. The argument passed to the function's formal
parameter can be used within the user-defined function.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact info.

- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.
 
I cannot seem to find a way to call a function from the menu's onaction, all
it will allow me to do is call a macro, I have defined the following function
that I would like to call.

Function Goto_Frm(ByVal frmName As String)
Dim frm as Form
For Each frm In Forms()
If frm.Visible = True Then
If frm.Caption = frmName Then frm.SetFocus
End If
Next
End Function

When I enter the function name in the onaction option, I get the following
message.

Can't run the macro or callback function 'Goto_Frm'
Make sure the macro of function exists and takes the correct parameters

Amiga1200
 
I cannot seem to find a way to call a function from the menu's onaction,
all
it will allow me to do is call a macro

Ensure that the equals sign precedes the public function name in the
OnAction Property:

=Goto_Frm("frmMyForm")

.. . . where frmMyForm is the name of the form. Also ensure that the public
function is saved in a standard module, not a class module.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 
Back
Top