Solved

Run VB Code via macro

Posted on 2011-09-09
4
438 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 119

Accepted Solution

by:
Rey Obrero earned 125 total points
Comment Utility
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
Comment Utility
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
Comment Utility
I didn't know I had to give it a function name inside the module. It works now.
0
 
LVL 119

Expert Comment

by:Rey Obrero
Comment Utility
<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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now