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.
- - -
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
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.