How can I pass an argument to a function called by the switchboard "run code" option?

I'm trying to streamline code by using just one function with arguments that I call from the Microsoft Access 2010 switchboard. I get an error and it appears that the "run code" option doesn't understand arguments.  Thanks!!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jeffrey CoachmanMIS LiasonCommented:
I rarely use those Macro commands, so there may now be a way to pass arguments.

I would just use VBA Functions, where augments are part of the syntax.

Function CalcTotal(Quant as long, Price As Currency) as Currency
End Function

...and you call it like this:

But you may have to give us the full details of exactly what you are doing...

Lets see what others may post in case I am misunderstanding something here...
pabrannPresidentAuthor Commented:
Thank you for the information. What you are suggesting is exactly what I'm trying. The issue is that I'm trying to call the function through the switchboard manager. In the "Switchboard Items" table I have the command item set to "8" which is supposed to run code. The Argument field I have set to the function name "Open_Orders_Regular(me!txtOrderType)".

The Switchboard functionality will not let me send the paramater "me!txtOrderType".  It works fine without trying to send a paramater.
The switchboard is very generic.  I also don't use it to run code.  What you might be able to do is to create your own general function and run that from the switchboard.  Your own function can then run the specific function and pass in arguments.

Also, you can actually modify the switchboard (at least the old one that used code rather than macros).  I use a modified version.  I increased the number of buttons from 8 to 12 because 8 is simply not enough.  I also added a couple of options such as the ability to open a form in DS view.  What you give up when you modify the switchboard is the ability to use the wizard to add rows past 8 or use your custom actions.  In some cases you can get around it by simply adding the item and choosing a standard function and then opening the Switchboard Items table an changing it.  I also wrote my own version of the switchboard wizard.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pabrannPresidentAuthor Commented:
That's what I needed, thank you very much!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.