Solved

Code for a module used on multiple forms

Posted on 2012-04-08
4
253 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

920 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

16 Experts available now in Live!

Get 1:1 Help Now