Solved

Code for a module used on multiple forms

Posted on 2012-04-08
4
244 Views
Last Modified: 2012-04-08
I have many forms that when they open all use the same code.  Is there a way to have each form look at a module for the code.  This would help in allowing me one place to make changes and not every form that needs it.  (I am using Access 2007.)

If this doesn't make sense let me know and I will try to explain more in depth.

V/r
John
0
Comment
Question by:John Sheehy
  • 2
4 Comments
 
LVL 33

Assisted Solution

by:Norie
Norie earned 250 total points
ID: 37821783
John

Yes, just put the code in a standard module and call it from the whatever event, eg Open, you are currently running it from.
0
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Access MVP) earned 250 total points
ID: 37821795
Expanding ...
After you create your Function (not a Sub) in a Standard Module, you can, if you like ... call it directly from the Property Sheet of a Control or Form - see image. And you can select multiple controls at once ... and paste in your Function name (with the equals sign) ...

fx
0
 

Author Comment

by:John Sheehy
ID: 37821874
You guys are genius'.  I appreciate the help.  I wasn't sure if it would work thay way and before I started changing things I wanted to be sure.  Thanks agian.

John
0
 
LVL 75
ID: 37821893
And of course, besides the Property sheet 'call', you can do it an VBA code anywhere:


' some code

Call mMySpecialFunction()

' more code

mx
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
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…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

708 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

13 Experts available now in Live!

Get 1:1 Help Now