Solved

Run VB Code via macro

Posted on 2011-09-09
4
473 Views
Last Modified: 2012-05-12
So I am creating a menu (customizing toolbars) in Access 2003 and I want to create a menu command to run a few lines of VB Code. Is there a way to do this in Access 2003? For example, create a module with the VB coding then create a macro that will run the module?

Thanks,
Dan
0
Comment
Question by:filtrationproducts
  • 2
  • 2
4 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 125 total points
ID: 36510523
the VB code that you need to run must be placed in a function in a regular module.

in the Action of your macro, you will place

RunCode


Function Name   myFunction()
0
 
LVL 1

Author Comment

by:filtrationproducts
ID: 36510777
I created a new module called newcpar and put the code in it. I then created a new macro and used RunCode with myFunction(newcpar) but it is not working.

Am I going about this right?

Dan
0
 
LVL 1

Author Closing Comment

by:filtrationproducts
ID: 36510806
I didn't know I had to give it a function name inside the module. It works now.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 36510816
<Am I going about this right?> gues Not

what is the name of the function that you placed in the module "newcpar" ?
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question